package b.l.a;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources.NotFoundException;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Looper;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater.Factory2;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.ScaleAnimation;
import android.view.animation.Transformation;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcher.LifecycleOnBackPressedCancellable;
import androidx.fragment.app.BackStackState;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManagerState;
import androidx.fragment.app.FragmentState;
import b.i.k.l;
import b.n.p;
import b.n.q;
import b.n.r;
import b.n.s;
import b.n.t;
import com.huawei.hms.analytics.core.crypto.AesCipher.AesLen;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;

/* compiled from: FragmentManagerImpl */
public final class i extends h implements Factory2 {
    public static final Interpolator G = new DecelerateInterpolator(2.5f);
    public static final Interpolator H = new DecelerateInterpolator(1.5f);
    public ArrayList<Fragment> A;
    public Bundle B = null;
    public SparseArray<Parcelable> C = null;
    public ArrayList<j> D;
    public m E;
    public Runnable F = new b();
    public ArrayList<h> c;
    public boolean d;
    public int e = 0;
    public final ArrayList<Fragment> f = new ArrayList();
    public final HashMap<String, Fragment> g = new HashMap();
    public ArrayList<a> h;
    public ArrayList<Fragment> i;
    public OnBackPressedDispatcher j;
    public final b.a.b k = new a(false);
    public ArrayList<a> l;
    public ArrayList<Integer> m;
    public final CopyOnWriteArrayList<f> n = new CopyOnWriteArrayList();
    public int o = 0;
    public g p;
    public d q;
    public Fragment r;
    public Fragment s;
    public boolean t;
    public boolean u;
    public boolean v;
    public boolean w;
    public boolean x;
    public ArrayList<a> y;
    public ArrayList<Boolean> z;

    /* compiled from: FragmentManagerImpl */
    public class b implements Runnable {
        public void run() {
            i.this.U();
        }
    }

    /* compiled from: FragmentManagerImpl */
    public static class d {
        public final Animation a;
        public final Animator b;

        public d(Animation animation) {
            this.a = animation;
            this.b = null;
        }

        public d(Animator animator) {
            this.a = null;
            this.b = animator;
        }
    }

    /* compiled from: FragmentManagerImpl */
    public static class e extends AnimationSet implements Runnable {
        public final ViewGroup a;
        public final View b;
        public boolean c;
        public boolean d;
        public boolean e = true;

        public e(Animation animation, ViewGroup viewGroup, View view) {
            super(false);
            this.a = viewGroup;
            this.b = view;
            addAnimation(animation);
            viewGroup.post(this);
        }

        public boolean getTransformation(long j, Transformation transformation) {
            this.e = true;
            if (this.c) {
                return this.d ^ 1;
            }
            if (!super.getTransformation(j, transformation)) {
                this.c = true;
                l.a(this.a, this);
            }
            return true;
        }

        public void run() {
            if (this.c || !this.e) {
                this.a.endViewTransition(this.b);
                this.d = true;
                return;
            }
            this.e = false;
            this.a.post(this);
        }

        public boolean getTransformation(long j, Transformation transformation, float f) {
            this.e = true;
            if (this.c) {
                return this.d ^ 1;
            }
            if (!super.getTransformation(j, transformation, f)) {
                this.c = true;
                l.a(this.a, this);
            }
            return true;
        }
    }

    /* compiled from: FragmentManagerImpl */
    public static final class f {
    }

    /* compiled from: FragmentManagerImpl */
    public static class g {
        public static final int[] a = new int[]{16842755, 16842960, 16842961};
    }

    /* compiled from: FragmentManagerImpl */
    public interface h {
        boolean a(ArrayList<a> arrayList, ArrayList<Boolean> arrayList2);
    }

    /* compiled from: FragmentManagerImpl */
    public class a extends b.a.b {
        public a(boolean z) {
            super(z);
        }

        public void a() {
            i iVar = i.this;
            iVar.U();
            if (iVar.k.a) {
                iVar.e();
            } else {
                iVar.j.a();
            }
        }
    }

    /* compiled from: FragmentManagerImpl */
    public class c extends f {
        public Fragment a(ClassLoader classLoader, String str) {
            g gVar = i.this.p;
            Context context = gVar.b;
            Objects.requireNonNull(gVar);
            Object obj = Fragment.V;
            String str2 = ": make sure class name exists, is public, and has an empty constructor that is public";
            String str3 = "Unable to instantiate fragment ";
            try {
                return (Fragment) f.c(context.getClassLoader(), str).getConstructor(new Class[0]).newInstance(new Object[0]);
            } catch (InstantiationException e) {
                throw new androidx.fragment.app.Fragment.b(c.b.a.a.a.E(str3, str, str2), e);
            } catch (IllegalAccessException e2) {
                throw new androidx.fragment.app.Fragment.b(c.b.a.a.a.E(str3, str, str2), e2);
            } catch (NoSuchMethodException e3) {
                throw new androidx.fragment.app.Fragment.b(c.b.a.a.a.E(str3, str, ": could not find Fragment constructor"), e3);
            } catch (InvocationTargetException e4) {
                throw new androidx.fragment.app.Fragment.b(c.b.a.a.a.E(str3, str, ": calling Fragment constructor caused an exception"), e4);
            }
        }
    }

    /* compiled from: FragmentManagerImpl */
    public class i implements h {
        public final int a;
        public final int b;

        public i(String str, int i, int i2) {
            this.a = i;
            this.b = i2;
        }

        public boolean a(ArrayList<a> arrayList, ArrayList<Boolean> arrayList2) {
            Fragment fragment = i.this.s;
            if (fragment != null && this.a < 0 && fragment.h().e()) {
                return false;
            }
            return i.this.k0(arrayList, arrayList2, null, this.a, this.b);
        }
    }

    /* compiled from: FragmentManagerImpl */
    public static class j implements androidx.fragment.app.Fragment.c {
        public final boolean a;
        public final a b;
        public int c;

        public j(a aVar, boolean z) {
            this.a = z;
            this.b = aVar;
        }

        public void a() {
            int i = this.c > 0 ? 1 : 0;
            i iVar = this.b.q;
            int size = iVar.f.size();
            for (int i2 = 0; i2 < size; i2++) {
                ((Fragment) iVar.f.get(i2)).i0(null);
            }
            a aVar = this.b;
            aVar.q.n(aVar, this.a, i ^ 1, true);
        }
    }

    public static d e0(float f, float f2, float f3, float f4) {
        Animation animationSet = new AnimationSet(false);
        ScaleAnimation scaleAnimation = new ScaleAnimation(f, f2, f, f2, 1, 0.5f, 1, 0.5f);
        scaleAnimation.setInterpolator(G);
        scaleAnimation.setDuration(220);
        animationSet.addAnimation(scaleAnimation);
        AlphaAnimation alphaAnimation = new AlphaAnimation(f3, f4);
        alphaAnimation.setInterpolator(H);
        alphaAnimation.setDuration(220);
        animationSet.addAnimation(alphaAnimation);
        return new d(animationSet);
    }

    public void A(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.A(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void B(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.B(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void C(Fragment fragment, Context context, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.C(fragment, context, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void D(Fragment fragment, Bundle bundle, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.D(fragment, bundle, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void E(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.E(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void F(Fragment fragment, Bundle bundle, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.F(fragment, bundle, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void G(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.G(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void H(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.H(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void I(Fragment fragment, View view, Bundle bundle, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.I(fragment, view, bundle, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void J(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.J(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public boolean K(MenuItem menuItem) {
        if (this.o < 1) {
            return false;
        }
        for (int i = 0; i < this.f.size(); i++) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null) {
                Object obj = (fragment.y || !fragment.t.K(menuItem)) ? null : 1;
                if (obj != null) {
                    return true;
                }
            }
        }
        return false;
    }

    public void L(Menu menu) {
        if (this.o >= 1) {
            for (int i = 0; i < this.f.size(); i++) {
                Fragment fragment = (Fragment) this.f.get(i);
                if (!(fragment == null || fragment.y)) {
                    fragment.t.L(menu);
                }
            }
        }
    }

    public final void M(Fragment fragment) {
        if (fragment != null && this.g.get(fragment.e) == fragment) {
            boolean b0 = fragment.r.b0(fragment);
            Boolean bool = fragment.j;
            if (bool == null || bool.booleanValue() != b0) {
                fragment.j = Boolean.valueOf(b0);
                i iVar = fragment.t;
                iVar.x0();
                iVar.M(iVar.s);
            }
        }
    }

    public void N(boolean z) {
        int size = this.f.size();
        while (true) {
            size--;
            if (size >= 0) {
                Fragment fragment = (Fragment) this.f.get(size);
                if (fragment != null) {
                    fragment.t.N(z);
                }
            } else {
                return;
            }
        }
    }

    public boolean O(Menu menu) {
        int i = 0;
        if (this.o < 1) {
            return false;
        }
        boolean z = false;
        while (i < this.f.size()) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null && fragment.W(menu)) {
                z = true;
            }
            i++;
        }
        return z;
    }

    public final void P(int i) {
        try {
            this.d = true;
            g0(i, false);
            U();
        } finally {
            this.d = false;
        }
    }

    public void Q() {
        if (this.x) {
            this.x = false;
            v0();
        }
    }

    public void R(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        Fragment fragment;
        int i;
        String D = c.b.a.a.a.D(str, "    ");
        if (!this.g.isEmpty()) {
            printWriter.print(str);
            printWriter.print("Active Fragments in ");
            printWriter.print(Integer.toHexString(System.identityHashCode(this)));
            printWriter.println(":");
            for (Fragment fragment2 : this.g.values()) {
                printWriter.print(str);
                printWriter.println(fragment2);
                if (fragment2 != null) {
                    printWriter.print(D);
                    printWriter.print("mFragmentId=#");
                    printWriter.print(Integer.toHexString(fragment2.v));
                    printWriter.print(" mContainerId=#");
                    printWriter.print(Integer.toHexString(fragment2.w));
                    printWriter.print(" mTag=");
                    printWriter.println(fragment2.x);
                    printWriter.print(D);
                    printWriter.print("mState=");
                    printWriter.print(fragment2.a);
                    printWriter.print(" mWho=");
                    printWriter.print(fragment2.e);
                    printWriter.print(" mBackStackNesting=");
                    printWriter.println(fragment2.q);
                    printWriter.print(D);
                    printWriter.print("mAdded=");
                    printWriter.print(fragment2.k);
                    printWriter.print(" mRemoving=");
                    printWriter.print(fragment2.l);
                    printWriter.print(" mFromLayout=");
                    printWriter.print(fragment2.m);
                    printWriter.print(" mInLayout=");
                    printWriter.println(fragment2.n);
                    printWriter.print(D);
                    printWriter.print("mHidden=");
                    printWriter.print(fragment2.y);
                    printWriter.print(" mDetached=");
                    printWriter.print(fragment2.z);
                    printWriter.print(" mMenuVisible=");
                    printWriter.print(fragment2.D);
                    printWriter.print(" mHasMenu=");
                    printWriter.println(fragment2.C);
                    printWriter.print(D);
                    printWriter.print("mRetainInstance=");
                    printWriter.print(fragment2.A);
                    printWriter.print(" mUserVisibleHint=");
                    printWriter.println(fragment2.J);
                    if (fragment2.r != null) {
                        printWriter.print(D);
                        printWriter.print("mFragmentManager=");
                        printWriter.println(fragment2.r);
                    }
                    if (fragment2.s != null) {
                        printWriter.print(D);
                        printWriter.print("mHost=");
                        printWriter.println(fragment2.s);
                    }
                    if (fragment2.u != null) {
                        printWriter.print(D);
                        printWriter.print("mParentFragment=");
                        printWriter.println(fragment2.u);
                    }
                    if (fragment2.f != null) {
                        printWriter.print(D);
                        printWriter.print("mArguments=");
                        printWriter.println(fragment2.f);
                    }
                    if (fragment2.b != null) {
                        printWriter.print(D);
                        printWriter.print("mSavedFragmentState=");
                        printWriter.println(fragment2.b);
                    }
                    if (fragment2.c != null) {
                        printWriter.print(D);
                        printWriter.print("mSavedViewState=");
                        printWriter.println(fragment2.c);
                    }
                    Object obj = fragment2.g;
                    if (obj == null) {
                        i iVar = fragment2.r;
                        if (iVar != null) {
                            String str2 = fragment2.h;
                            if (str2 != null) {
                                obj = (Fragment) iVar.g.get(str2);
                            }
                        }
                        obj = null;
                    }
                    if (obj != null) {
                        printWriter.print(D);
                        printWriter.print("mTarget=");
                        printWriter.print(obj);
                        printWriter.print(" mTargetRequestCode=");
                        printWriter.println(fragment2.i);
                    }
                    if (fragment2.o() != 0) {
                        printWriter.print(D);
                        printWriter.print("mNextAnim=");
                        printWriter.println(fragment2.o());
                    }
                    if (fragment2.F != null) {
                        printWriter.print(D);
                        printWriter.print("mContainer=");
                        printWriter.println(fragment2.F);
                    }
                    if (fragment2.G != null) {
                        printWriter.print(D);
                        printWriter.print("mView=");
                        printWriter.println(fragment2.G);
                    }
                    if (fragment2.H != null) {
                        printWriter.print(D);
                        printWriter.print("mInnerView=");
                        printWriter.println(fragment2.G);
                    }
                    if (fragment2.f() != null) {
                        printWriter.print(D);
                        printWriter.print("mAnimatingAway=");
                        printWriter.println(fragment2.f());
                        printWriter.print(D);
                        printWriter.print("mStateAfterAnimating=");
                        printWriter.println(fragment2.w());
                    }
                    if (fragment2.k() != null) {
                        b.o.a.a.b(fragment2).a(D, fileDescriptor, printWriter, strArr);
                    }
                    printWriter.print(D);
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("Child ");
                    stringBuilder.append(fragment2.t);
                    stringBuilder.append(":");
                    printWriter.println(stringBuilder.toString());
                    fragment2.t.R(c.b.a.a.a.D(D, "  "), fileDescriptor, printWriter, strArr);
                }
            }
        }
        int size = this.f.size();
        if (size > 0) {
            printWriter.print(str);
            printWriter.println("Added Fragments:");
            for (i = 0; i < size; i++) {
                fragment2 = (Fragment) this.f.get(i);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i);
                printWriter.print(": ");
                printWriter.println(fragment2.toString());
            }
        }
        ArrayList arrayList = this.i;
        if (arrayList != null) {
            size = arrayList.size();
            if (size > 0) {
                printWriter.print(str);
                printWriter.println("Fragments Created Menus:");
                for (i = 0; i < size; i++) {
                    fragment2 = (Fragment) this.i.get(i);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i);
                    printWriter.print(": ");
                    printWriter.println(fragment2.toString());
                }
            }
        }
        arrayList = this.h;
        if (arrayList != null) {
            size = arrayList.size();
            if (size > 0) {
                printWriter.print(str);
                printWriter.println("Back Stack:");
                for (i = 0; i < size; i++) {
                    a aVar = (a) this.h.get(i);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i);
                    printWriter.print(": ");
                    printWriter.println(aVar.toString());
                    aVar.m(D, printWriter, true);
                }
            }
        }
        synchronized (this) {
            arrayList = this.l;
            if (arrayList != null) {
                size = arrayList.size();
                if (size > 0) {
                    printWriter.print(str);
                    printWriter.println("Back Stack Indices:");
                    for (int i2 = 0; i2 < size; i2++) {
                        a aVar2 = (a) this.l.get(i2);
                        printWriter.print(str);
                        printWriter.print("  #");
                        printWriter.print(i2);
                        printWriter.print(": ");
                        printWriter.println(aVar2);
                    }
                }
            }
            arrayList = this.m;
            if (arrayList != null && arrayList.size() > 0) {
                printWriter.print(str);
                printWriter.print("mAvailBackStackIndices: ");
                printWriter.println(Arrays.toString(this.m.toArray()));
            }
        }
        arrayList = this.c;
        if (arrayList != null) {
            size = arrayList.size();
            if (size > 0) {
                printWriter.print(str);
                printWriter.println("Pending Actions:");
                for (int i3 = 0; i3 < size; i3++) {
                    h hVar = (h) this.c.get(i3);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(i3);
                    printWriter.print(": ");
                    printWriter.println(hVar);
                }
            }
        }
        printWriter.print(str);
        printWriter.println("FragmentManager misc state:");
        printWriter.print(str);
        printWriter.print("  mHost=");
        printWriter.println(this.p);
        printWriter.print(str);
        printWriter.print("  mContainer=");
        printWriter.println(this.q);
        if (this.r != null) {
            printWriter.print(str);
            printWriter.print("  mParent=");
            printWriter.println(this.r);
        }
        printWriter.print(str);
        printWriter.print("  mCurState=");
        printWriter.print(this.o);
        printWriter.print(" mStateSaved=");
        printWriter.print(this.u);
        printWriter.print(" mStopped=");
        printWriter.print(this.v);
        printWriter.print(" mDestroyed=");
        printWriter.println(this.w);
        if (this.t) {
            printWriter.print(str);
            printWriter.print("  mNeedMenuInvalidate=");
            printWriter.println(this.t);
        }
    }

    public void S(h hVar, boolean z) {
        if (!z) {
            l();
        }
        synchronized (this) {
            if (!this.w) {
                if (this.p != null) {
                    if (this.c == null) {
                        this.c = new ArrayList();
                    }
                    this.c.add(hVar);
                    s0();
                    return;
                }
            }
            if (z) {
                return;
            }
            throw new IllegalStateException("Activity has been destroyed");
        }
    }

    public final void T(boolean z) {
        if (this.d) {
            throw new IllegalStateException("FragmentManager is already executing transactions");
        } else if (this.p == null) {
            throw new IllegalStateException("Fragment host has been destroyed");
        } else if (Looper.myLooper() == this.p.c.getLooper()) {
            if (!z) {
                l();
            }
            if (this.y == null) {
                this.y = new ArrayList();
                this.z = new ArrayList();
            }
            this.d = true;
            try {
                W(null, null);
            } finally {
                this.d = false;
            }
        } else {
            throw new IllegalStateException("Must be called from main thread of fragment host");
        }
    }

    public boolean U() {
        T(true);
        boolean z = false;
        while (true) {
            int i;
            ArrayList arrayList = this.y;
            ArrayList arrayList2 = this.z;
            synchronized (this) {
                try {
                    ArrayList arrayList3 = this.c;
                    if (arrayList3 != null) {
                        if (arrayList3.size() != 0) {
                            i = 0;
                            for (int i2 = 0; i2 < this.c.size(); i2++) {
                                i |= ((h) this.c.get(i2)).a(arrayList, arrayList2);
                            }
                            this.c.clear();
                            this.p.c.removeCallbacks(this.F);
                        }
                    }
                    i = 0;
                } catch (Throwable th) {
                    while (true) {
                        throw th;
                    }
                }
            }
            if (i != 0) {
                this.d = true;
                try {
                    m0(this.y, this.z);
                    m();
                    z = true;
                } catch (Throwable th2) {
                    m();
                    throw th2;
                }
            }
            x0();
            Q();
            k();
            return z;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:114:0x024b  */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x01fe  */
    public final void V(java.util.ArrayList<b.l.a.a> r20, java.util.ArrayList<java.lang.Boolean> r21, int r22, int r23) {
        /*
        r19 = this;
        r7 = r19;
        r0 = r20;
        r8 = r21;
        r9 = r22;
        r10 = r23;
        r1 = r0.get(r9);
        r1 = (b.l.a.a) r1;
        r11 = r1.p;
        r1 = r7.A;
        if (r1 != 0) goto L_0x001e;
    L_0x0016:
        r1 = new java.util.ArrayList;
        r1.<init>();
        r7.A = r1;
        goto L_0x0021;
    L_0x001e:
        r1.clear();
    L_0x0021:
        r1 = r7.A;
        r2 = r7.f;
        r1.addAll(r2);
        r1 = r7.s;
        r2 = r9;
        r3 = 0;
    L_0x002c:
        r15 = 1;
        if (r2 >= r10) goto L_0x0169;
    L_0x002f:
        r4 = r0.get(r2);
        r4 = (b.l.a.a) r4;
        r5 = r8.get(r2);
        r5 = (java.lang.Boolean) r5;
        r5 = r5.booleanValue();
        r6 = 3;
        if (r5 != 0) goto L_0x011e;
    L_0x0042:
        r5 = r7.A;
        r13 = 0;
    L_0x0045:
        r12 = r4.a;
        r12 = r12.size();
        if (r13 >= r12) goto L_0x0157;
    L_0x004d:
        r12 = r4.a;
        r12 = r12.get(r13);
        r12 = (b.l.a.p.a) r12;
        r14 = r12.a;
        if (r14 == r15) goto L_0x010f;
    L_0x0059:
        r15 = 2;
        r9 = 9;
        if (r14 == r15) goto L_0x0094;
    L_0x005e:
        if (r14 == r6) goto L_0x007c;
    L_0x0060:
        r15 = 6;
        if (r14 == r15) goto L_0x007c;
    L_0x0063:
        r15 = 7;
        if (r14 == r15) goto L_0x010f;
    L_0x0066:
        r15 = 8;
        if (r14 == r15) goto L_0x006c;
    L_0x006a:
        goto L_0x0106;
    L_0x006c:
        r14 = r4.a;
        r15 = new b.l.a.p$a;
        r15.m581init(r9, r1);
        r14.add(r13, r15);
        r13 = r13 + 1;
        r1 = r12.b;
        goto L_0x0106;
    L_0x007c:
        r14 = r12.b;
        r5.remove(r14);
        r12 = r12.b;
        if (r12 != r1) goto L_0x0106;
    L_0x0085:
        r1 = r4.a;
        r14 = new b.l.a.p$a;
        r14.m581init(r9, r12);
        r1.add(r13, r14);
        r13 = r13 + 1;
        r1 = 0;
        goto L_0x0106;
    L_0x0094:
        r14 = r12.b;
        r15 = r14.w;
        r17 = r5.size();
        r16 = -1;
        r17 = r17 + -1;
        r6 = r17;
        r17 = 0;
    L_0x00a4:
        if (r6 < 0) goto L_0x00fd;
    L_0x00a6:
        r18 = r5.get(r6);
        r9 = r18;
        r9 = (androidx.fragment.app.Fragment) r9;
        r8 = r9.w;
        if (r8 != r15) goto L_0x00f2;
    L_0x00b2:
        if (r9 != r14) goto L_0x00b9;
    L_0x00b4:
        r18 = r15;
        r17 = 1;
        goto L_0x00f4;
    L_0x00b9:
        if (r9 != r1) goto L_0x00cd;
    L_0x00bb:
        r1 = r4.a;
        r8 = new b.l.a.p$a;
        r18 = r15;
        r15 = 9;
        r8.m581init(r15, r9);
        r1.add(r13, r8);
        r13 = r13 + 1;
        r1 = 0;
        goto L_0x00d1;
    L_0x00cd:
        r18 = r15;
        r15 = 9;
    L_0x00d1:
        r8 = new b.l.a.p$a;
        r15 = 3;
        r8.m581init(r15, r9);
        r15 = r12.c;
        r8.c = r15;
        r15 = r12.e;
        r8.e = r15;
        r15 = r12.d;
        r8.d = r15;
        r15 = r12.f;
        r8.f = r15;
        r15 = r4.a;
        r15.add(r13, r8);
        r5.remove(r9);
        r8 = 1;
        r13 = r13 + r8;
        goto L_0x00f4;
    L_0x00f2:
        r18 = r15;
    L_0x00f4:
        r6 = r6 + -1;
        r8 = r21;
        r15 = r18;
        r9 = 9;
        goto L_0x00a4;
    L_0x00fd:
        if (r17 == 0) goto L_0x0108;
    L_0x00ff:
        r6 = r4.a;
        r6.remove(r13);
        r13 = r13 + -1;
    L_0x0106:
        r6 = 1;
        goto L_0x0115;
    L_0x0108:
        r6 = 1;
        r12.a = r6;
        r5.add(r14);
        goto L_0x0115;
    L_0x010f:
        r6 = 1;
        r8 = r12.b;
        r5.add(r8);
    L_0x0115:
        r13 = r13 + r6;
        r8 = r21;
        r9 = r22;
        r6 = 3;
        r15 = 1;
        goto L_0x0045;
    L_0x011e:
        r6 = 1;
        r5 = r7.A;
        r8 = r4.a;
        r8 = r8.size();
        r8 = r8 - r6;
    L_0x0128:
        if (r8 < 0) goto L_0x0157;
    L_0x012a:
        r9 = r4.a;
        r9 = r9.get(r8);
        r9 = (b.l.a.p.a) r9;
        r12 = r9.a;
        if (r12 == r6) goto L_0x014d;
    L_0x0136:
        r6 = 3;
        if (r12 == r6) goto L_0x0147;
    L_0x0139:
        switch(r12) {
            case 6: goto L_0x0147;
            case 7: goto L_0x014e;
            case 8: goto L_0x0145;
            case 9: goto L_0x0142;
            case 10: goto L_0x013d;
            default: goto L_0x013c;
        };
    L_0x013c:
        goto L_0x0153;
    L_0x013d:
        r12 = r9.g;
        r9.h = r12;
        goto L_0x0153;
    L_0x0142:
        r1 = r9.b;
        goto L_0x0153;
    L_0x0145:
        r1 = 0;
        goto L_0x0153;
    L_0x0147:
        r9 = r9.b;
        r5.add(r9);
        goto L_0x0153;
    L_0x014d:
        r6 = 3;
    L_0x014e:
        r9 = r9.b;
        r5.remove(r9);
    L_0x0153:
        r8 = r8 + -1;
        r6 = 1;
        goto L_0x0128;
    L_0x0157:
        if (r3 != 0) goto L_0x0160;
    L_0x0159:
        r3 = r4.h;
        if (r3 == 0) goto L_0x015e;
    L_0x015d:
        goto L_0x0160;
    L_0x015e:
        r3 = 0;
        goto L_0x0161;
    L_0x0160:
        r3 = 1;
    L_0x0161:
        r2 = r2 + 1;
        r8 = r21;
        r9 = r22;
        goto L_0x002c;
    L_0x0169:
        r1 = r7.A;
        r1.clear();
        if (r11 != 0) goto L_0x017e;
    L_0x0170:
        r6 = 0;
        r1 = r19;
        r2 = r20;
        r3 = r21;
        r4 = r22;
        r5 = r23;
        b.l.a.u.o(r1, r2, r3, r4, r5, r6);
    L_0x017e:
        r1 = r22;
    L_0x0180:
        if (r1 >= r10) goto L_0x01af;
    L_0x0182:
        r2 = r0.get(r1);
        r2 = (b.l.a.a) r2;
        r8 = r21;
        r3 = r8.get(r1);
        r3 = (java.lang.Boolean) r3;
        r3 = r3.booleanValue();
        if (r3 == 0) goto L_0x01a5;
    L_0x0196:
        r3 = -1;
        r2.i(r3);
        r3 = r10 + -1;
        if (r1 != r3) goto L_0x01a0;
    L_0x019e:
        r3 = 1;
        goto L_0x01a1;
    L_0x01a0:
        r3 = 0;
    L_0x01a1:
        r2.o(r3);
        goto L_0x01ac;
    L_0x01a5:
        r3 = 1;
        r2.i(r3);
        r2.n();
    L_0x01ac:
        r1 = r1 + 1;
        goto L_0x0180;
    L_0x01af:
        r8 = r21;
        if (r11 == 0) goto L_0x0273;
    L_0x01b3:
        r1 = new b.f.c;
        r1.m384init();
        r7.g(r1);
        r2 = r10 + -1;
        r9 = r22;
        r3 = r10;
    L_0x01c0:
        if (r2 < r9) goto L_0x0250;
    L_0x01c2:
        r4 = r0.get(r2);
        r4 = (b.l.a.a) r4;
        r5 = r8.get(r2);
        r5 = (java.lang.Boolean) r5;
        r5 = r5.booleanValue();
        r6 = 0;
    L_0x01d3:
        r12 = r4.a;
        r12 = r12.size();
        if (r6 >= r12) goto L_0x01ee;
    L_0x01db:
        r12 = r4.a;
        r12 = r12.get(r6);
        r12 = (b.l.a.p.a) r12;
        r12 = b.l.a.a.r(r12);
        if (r12 == 0) goto L_0x01eb;
    L_0x01e9:
        r6 = 1;
        goto L_0x01ef;
    L_0x01eb:
        r6 = r6 + 1;
        goto L_0x01d3;
    L_0x01ee:
        r6 = 0;
    L_0x01ef:
        if (r6 == 0) goto L_0x01fb;
    L_0x01f1:
        r6 = r2 + 1;
        r6 = r4.q(r0, r6, r10);
        if (r6 != 0) goto L_0x01fb;
    L_0x01f9:
        r6 = 1;
        goto L_0x01fc;
    L_0x01fb:
        r6 = 0;
    L_0x01fc:
        if (r6 == 0) goto L_0x024b;
    L_0x01fe:
        r6 = r7.D;
        if (r6 != 0) goto L_0x0209;
    L_0x0202:
        r6 = new java.util.ArrayList;
        r6.<init>();
        r7.D = r6;
    L_0x0209:
        r6 = new b.l.a.i$j;
        r6.m5091init(r4, r5);
        r12 = r7.D;
        r12.add(r6);
        r12 = 0;
    L_0x0214:
        r13 = r4.a;
        r13 = r13.size();
        if (r12 >= r13) goto L_0x0232;
    L_0x021c:
        r13 = r4.a;
        r13 = r13.get(r12);
        r13 = (b.l.a.p.a) r13;
        r14 = b.l.a.a.r(r13);
        if (r14 == 0) goto L_0x022f;
    L_0x022a:
        r13 = r13.b;
        r13.i0(r6);
    L_0x022f:
        r12 = r12 + 1;
        goto L_0x0214;
    L_0x0232:
        if (r5 == 0) goto L_0x0239;
    L_0x0234:
        r4.n();
        r5 = 0;
        goto L_0x023d;
    L_0x0239:
        r5 = 0;
        r4.o(r5);
    L_0x023d:
        r3 = r3 + -1;
        if (r2 == r3) goto L_0x0247;
    L_0x0241:
        r0.remove(r2);
        r0.add(r3, r4);
    L_0x0247:
        r7.g(r1);
        goto L_0x024c;
    L_0x024b:
        r5 = 0;
    L_0x024c:
        r2 = r2 + -1;
        goto L_0x01c0;
    L_0x0250:
        r5 = 0;
        r2 = r1.c;
        r12 = 0;
    L_0x0254:
        if (r12 >= r2) goto L_0x0271;
    L_0x0256:
        r4 = r1.b;
        r4 = r4[r12];
        r4 = (androidx.fragment.app.Fragment) r4;
        r5 = r4.k;
        if (r5 != 0) goto L_0x026e;
    L_0x0260:
        r5 = r4.b0();
        r6 = r5.getAlpha();
        r4.N = r6;
        r4 = 0;
        r5.setAlpha(r4);
    L_0x026e:
        r12 = r12 + 1;
        goto L_0x0254;
    L_0x0271:
        r5 = r3;
        goto L_0x0276;
    L_0x0273:
        r9 = r22;
        r5 = r10;
    L_0x0276:
        if (r5 == r9) goto L_0x028c;
    L_0x0278:
        if (r11 == 0) goto L_0x028c;
    L_0x027a:
        r6 = 1;
        r1 = r19;
        r2 = r20;
        r3 = r21;
        r4 = r22;
        b.l.a.u.o(r1, r2, r3, r4, r5, r6);
        r1 = r7.o;
        r2 = 1;
        r7.g0(r1, r2);
    L_0x028c:
        if (r9 >= r10) goto L_0x02cf;
    L_0x028e:
        r1 = r0.get(r9);
        r1 = (b.l.a.a) r1;
        r2 = r8.get(r9);
        r2 = (java.lang.Boolean) r2;
        r2 = r2.booleanValue();
        if (r2 == 0) goto L_0x02c7;
    L_0x02a0:
        r2 = r1.s;
        if (r2 < 0) goto L_0x02c7;
    L_0x02a4:
        monitor-enter(r19);
        r3 = r7.l;	 Catch:{ all -> 0x02c4 }
        r4 = 0;
        r3.set(r2, r4);	 Catch:{ all -> 0x02c4 }
        r3 = r7.m;	 Catch:{ all -> 0x02c4 }
        if (r3 != 0) goto L_0x02b6;
    L_0x02af:
        r3 = new java.util.ArrayList;	 Catch:{ all -> 0x02c4 }
        r3.<init>();	 Catch:{ all -> 0x02c4 }
        r7.m = r3;	 Catch:{ all -> 0x02c4 }
    L_0x02b6:
        r3 = r7.m;	 Catch:{ all -> 0x02c4 }
        r2 = java.lang.Integer.valueOf(r2);	 Catch:{ all -> 0x02c4 }
        r3.add(r2);	 Catch:{ all -> 0x02c4 }
        monitor-exit(r19);	 Catch:{ all -> 0x02c4 }
        r2 = -1;
        r1.s = r2;
        goto L_0x02c9;
    L_0x02c4:
        r0 = move-exception;
        monitor-exit(r19);	 Catch:{ all -> 0x02c4 }
        throw r0;
    L_0x02c7:
        r2 = -1;
        r4 = 0;
    L_0x02c9:
        java.util.Objects.requireNonNull(r1);
        r9 = r9 + 1;
        goto L_0x028c;
    L_0x02cf:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.l.a.i.V(java.util.ArrayList, java.util.ArrayList, int, int):void");
    }

    public final void W(ArrayList<a> arrayList, ArrayList<Boolean> arrayList2) {
        ArrayList arrayList3 = this.D;
        int size = arrayList3 == null ? 0 : arrayList3.size();
        int i = 0;
        while (i < size) {
            int indexOf;
            a aVar;
            j jVar = (j) this.D.get(i);
            if (!(arrayList == null || jVar.a)) {
                indexOf = arrayList.indexOf(jVar.b);
                if (indexOf != -1 && ((Boolean) arrayList2.get(indexOf)).booleanValue()) {
                    this.D.remove(i);
                    i--;
                    size--;
                    aVar = jVar.b;
                    aVar.q.n(aVar, jVar.a, false, false);
                    i++;
                }
            }
            if ((jVar.c == 0 ? 1 : null) != null || (arrayList != null && jVar.b.q(arrayList, 0, arrayList.size()))) {
                this.D.remove(i);
                i--;
                size--;
                if (!(arrayList == null || jVar.a)) {
                    indexOf = arrayList.indexOf(jVar.b);
                    if (indexOf != -1 && ((Boolean) arrayList2.get(indexOf)).booleanValue()) {
                        aVar = jVar.b;
                        aVar.q.n(aVar, jVar.a, false, false);
                    }
                }
                jVar.a();
            }
            i++;
        }
    }

    public Fragment X(String str) {
        for (Fragment fragment : this.g.values()) {
            Fragment fragment2;
            if (fragment2 != null) {
                if (!str.equals(fragment2.e)) {
                    fragment2 = fragment2.t.X(str);
                }
                if (fragment2 != null) {
                    return fragment2;
                }
            }
        }
        return null;
    }

    public final void Y() {
        if (this.D != null) {
            while (!this.D.isEmpty()) {
                ((j) this.D.remove(0)).a();
            }
        }
    }

    public f Z() {
        if (this.a == null) {
            this.a = h.b;
        }
        f fVar = this.a;
        f fVar2 = h.b;
        if (fVar == fVar2) {
            Fragment fragment = this.r;
            if (fragment != null) {
                return fragment.r.Z();
            }
            this.a = new c();
        }
        if (this.a == null) {
            this.a = fVar2;
        }
        return this.a;
    }

    public Fragment a(int i) {
        Fragment fragment;
        for (int size = this.f.size() - 1; size >= 0; size--) {
            fragment = (Fragment) this.f.get(size);
            if (fragment != null && fragment.v == i) {
                return fragment;
            }
        }
        for (Fragment fragment2 : this.g.values()) {
            if (fragment2 != null && fragment2.v == i) {
                return fragment2;
            }
        }
        return null;
    }

    public final boolean a0(Fragment fragment) {
        if (fragment.C && fragment.D) {
            return true;
        }
        Object obj;
        i iVar = fragment.t;
        boolean z = false;
        for (Fragment fragment2 : iVar.g.values()) {
            if (fragment2 != null) {
                z = iVar.a0(fragment2);
                continue;
            }
            if (z) {
                obj = 1;
                break;
            }
        }
        obj = null;
        if (obj != null) {
            return true;
        }
        return false;
    }

    public Fragment b(String str) {
        Fragment fragment;
        if (str != null) {
            for (int size = this.f.size() - 1; size >= 0; size--) {
                fragment = (Fragment) this.f.get(size);
                if (fragment != null && str.equals(fragment.x)) {
                    return fragment;
                }
            }
        }
        if (str != null) {
            for (Fragment fragment2 : this.g.values()) {
                if (fragment2 != null && str.equals(fragment2.x)) {
                    return fragment2;
                }
            }
        }
        return null;
    }

    public boolean b0(Fragment fragment) {
        boolean z = true;
        if (fragment == null) {
            return true;
        }
        i iVar = fragment.r;
        if (!(fragment == iVar.s && b0(iVar.r))) {
            z = false;
        }
        return z;
    }

    public Fragment c(Bundle bundle, String str) {
        String string = bundle.getString(str);
        if (string == null) {
            return null;
        }
        Fragment fragment = (Fragment) this.g.get(string);
        if (fragment != null) {
            return fragment;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("Fragment no longer exists for key ");
        stringBuilder.append(str);
        stringBuilder.append(": unique id ");
        stringBuilder.append(string);
        w0(new IllegalStateException(stringBuilder.toString()));
        throw null;
    }

    public d c0(Fragment fragment, int i, boolean z, int i2) {
        int o = fragment.o();
        int i3 = 0;
        fragment.h0(0);
        ViewGroup viewGroup = fragment.F;
        if (viewGroup != null && viewGroup.getLayoutTransition() != null) {
            return null;
        }
        Object obj = 1;
        if (o != 0) {
            boolean equals = "anim".equals(this.p.b.getResources().getResourceTypeName(o));
            if (equals) {
                try {
                    Animation loadAnimation = AnimationUtils.loadAnimation(this.p.b, o);
                    if (loadAnimation != null) {
                        return new d(loadAnimation);
                    }
                    i3 = 1;
                } catch (NotFoundException e) {
                    throw e;
                } catch (RuntimeException unused) {
                }
            }
            if (i3 == 0) {
                try {
                    Animator loadAnimator = AnimatorInflater.loadAnimator(this.p.b, o);
                    if (loadAnimator != null) {
                        return new d(loadAnimator);
                    }
                } catch (RuntimeException e2) {
                    if (equals) {
                        throw e2;
                    }
                    Animation loadAnimation2 = AnimationUtils.loadAnimation(this.p.b, o);
                    if (loadAnimation2 != null) {
                        return new d(loadAnimation2);
                    }
                }
            }
        }
        if (i == 0) {
            return null;
        }
        if (i != 4097) {
            obj = i != 4099 ? i != 8194 ? -1 : z ? 3 : 4 : z ? 5 : 6;
        } else if (!z) {
            obj = 2;
        }
        if (obj < null) {
            return null;
        }
        Animation alphaAnimation;
        switch (obj) {
            case 1:
                return e0(1.125f, 1.0f, 0.0f, 1.0f);
            case 2:
                return e0(1.0f, 0.975f, 1.0f, 0.0f);
            case 3:
                return e0(0.975f, 1.0f, 0.0f, 1.0f);
            case 4:
                return e0(1.0f, 1.075f, 1.0f, 0.0f);
            case 5:
                alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
                alphaAnimation.setInterpolator(H);
                alphaAnimation.setDuration(220);
                return new d(alphaAnimation);
            case 6:
                alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
                alphaAnimation.setInterpolator(H);
                alphaAnimation.setDuration(220);
                return new d(alphaAnimation);
            default:
                if (i2 == 0 && this.p.l()) {
                    this.p.k();
                }
                return null;
        }
    }

    public boolean d() {
        return this.u || this.v;
    }

    public void d0(Fragment fragment) {
        if (this.g.get(fragment.e) == null) {
            this.g.put(fragment.e, fragment);
            if (fragment.B) {
                if (!fragment.A) {
                    n0(fragment);
                } else if (!d()) {
                    this.E.b.add(fragment);
                }
                fragment.B = false;
            }
        }
    }

    public boolean e() {
        l();
        U();
        T(true);
        Fragment fragment = this.s;
        if (fragment != null && fragment.h().e()) {
            return true;
        }
        boolean k0 = k0(this.y, this.z, null, -1, 0);
        if (k0) {
            this.d = true;
            try {
                m0(this.y, this.z);
            } finally {
                m();
            }
        }
        x0();
        Q();
        k();
        return k0;
    }

    public void f(Bundle bundle, String str, Fragment fragment) {
        if (fragment.r == this) {
            bundle.putString(str, fragment.e);
        } else {
            w0(new IllegalStateException(c.b.a.a.a.C("Fragment ", fragment, " is not currently in the FragmentManager")));
            throw null;
        }
    }

    public void f0(Fragment fragment) {
        if (fragment != null && this.g.containsKey(fragment.e)) {
            ViewGroup viewGroup;
            d c0;
            int i = this.o;
            if (fragment.l) {
                if (fragment.B()) {
                    i = Math.min(i, 1);
                } else {
                    i = Math.min(i, 0);
                }
            }
            h0(fragment, i, fragment.p(), fragment.q(), false);
            View view = fragment.G;
            if (view != null) {
                viewGroup = fragment.F;
                Fragment fragment2 = null;
                if (viewGroup != null && view != null) {
                    i = this.f.indexOf(fragment);
                    while (true) {
                        i--;
                        if (i < 0) {
                            break;
                        }
                        Fragment fragment3 = (Fragment) this.f.get(i);
                        if (fragment3.F == viewGroup && fragment3.G != null) {
                            fragment2 = fragment3;
                            break;
                        }
                    }
                }
                if (fragment2 != null) {
                    view = fragment2.G;
                    viewGroup = fragment.F;
                    i = viewGroup.indexOfChild(view);
                    int indexOfChild = viewGroup.indexOfChild(fragment.G);
                    if (indexOfChild < i) {
                        viewGroup.removeViewAt(indexOfChild);
                        viewGroup.addView(fragment.G, i);
                    }
                }
                if (fragment.L && fragment.F != null) {
                    float f = fragment.N;
                    if (f > 0.0f) {
                        fragment.G.setAlpha(f);
                    }
                    fragment.N = 0.0f;
                    fragment.L = false;
                    c0 = c0(fragment, fragment.p(), true, fragment.q());
                    if (c0 != null) {
                        Animation animation = c0.a;
                        if (animation != null) {
                            fragment.G.startAnimation(animation);
                        } else {
                            c0.b.setTarget(fragment.G);
                            c0.b.start();
                        }
                    }
                }
            }
            if (fragment.M) {
                if (fragment.G != null) {
                    c0 = c0(fragment, fragment.p(), fragment.y ^ 1, fragment.q());
                    if (c0 != null) {
                        Animator animator = c0.b;
                        if (animator != null) {
                            animator.setTarget(fragment.G);
                            if (!fragment.y) {
                                fragment.G.setVisibility(0);
                            } else if (fragment.A()) {
                                fragment.f0(false);
                            } else {
                                viewGroup = fragment.F;
                                View view2 = fragment.G;
                                viewGroup.startViewTransition(view2);
                                c0.b.addListener(new l(this, viewGroup, view2, fragment));
                            }
                            c0.b.start();
                        }
                    }
                    if (c0 != null) {
                        fragment.G.startAnimation(c0.a);
                        c0.a.start();
                    }
                    i = (!fragment.y || fragment.A()) ? 0 : 8;
                    fragment.G.setVisibility(i);
                    if (fragment.A()) {
                        fragment.f0(false);
                    }
                }
                if (fragment.k && a0(fragment)) {
                    this.t = true;
                }
                fragment.M = false;
            }
        }
    }

    public final void g(b.f.c<Fragment> cVar) {
        int i = this.o;
        if (i >= 1) {
            i = Math.min(i, 3);
            int size = this.f.size();
            for (int i2 = 0; i2 < size; i2++) {
                Fragment fragment = (Fragment) this.f.get(i2);
                if (fragment.a < i) {
                    h0(fragment, i, fragment.o(), fragment.p(), false);
                    if (!(fragment.G == null || fragment.y || !fragment.L)) {
                        cVar.add(fragment);
                    }
                }
            }
        }
    }

    public void g0(int i, boolean z) {
        if (this.p == null && i != 0) {
            throw new IllegalStateException("No activity");
        } else if (z || i != this.o) {
            this.o = i;
            i = this.f.size();
            for (int i2 = 0; i2 < i; i2++) {
                f0((Fragment) this.f.get(i2));
            }
            for (Fragment fragment : this.g.values()) {
                if (fragment != null && ((fragment.l || fragment.z) && !fragment.L)) {
                    f0(fragment);
                }
            }
            v0();
            if (this.t) {
                g gVar = this.p;
                if (gVar != null && this.o == 4) {
                    gVar.q();
                    this.t = false;
                }
            }
        }
    }

    public void h(Fragment fragment, boolean z) {
        d0(fragment);
        if (!fragment.z) {
            if (this.f.contains(fragment)) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("Fragment already added: ");
                stringBuilder.append(fragment);
                throw new IllegalStateException(stringBuilder.toString());
            }
            synchronized (this.f) {
                this.f.add(fragment);
            }
            fragment.k = true;
            fragment.l = false;
            if (fragment.G == null) {
                fragment.M = false;
            }
            if (a0(fragment)) {
                this.t = true;
            }
            if (z) {
                h0(fragment, this.o, 0, 0, false);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:169:0x033f  */
    /* JADX WARNING: Removed duplicated region for block: B:179:0x0384  */
    /* JADX WARNING: Removed duplicated region for block: B:336:0x06e2  */
    /* JADX WARNING: Missing block: B:43:0x0084, code skipped:
            if (r0 != 3) goto L_0x06dd;
     */
    public void h0(androidx.fragment.app.Fragment r17, int r18, int r19, int r20, boolean r21) {
        /*
        r16 = this;
        r6 = r16;
        r7 = r17;
        r0 = r7.k;
        r8 = 1;
        if (r0 == 0) goto L_0x0011;
    L_0x0009:
        r0 = r7.z;
        if (r0 == 0) goto L_0x000e;
    L_0x000d:
        goto L_0x0011;
    L_0x000e:
        r0 = r18;
        goto L_0x0016;
    L_0x0011:
        r0 = r18;
        if (r0 <= r8) goto L_0x0016;
    L_0x0015:
        r0 = 1;
    L_0x0016:
        r1 = r7.l;
        if (r1 == 0) goto L_0x002a;
    L_0x001a:
        r1 = r7.a;
        if (r0 <= r1) goto L_0x002a;
    L_0x001e:
        if (r1 != 0) goto L_0x0028;
    L_0x0020:
        r0 = r17.B();
        if (r0 == 0) goto L_0x0028;
    L_0x0026:
        r0 = 1;
        goto L_0x002a;
    L_0x0028:
        r0 = r7.a;
    L_0x002a:
        r1 = r7.I;
        r9 = 2;
        r10 = 3;
        if (r1 == 0) goto L_0x0037;
    L_0x0030:
        r1 = r7.a;
        if (r1 >= r10) goto L_0x0037;
    L_0x0034:
        if (r0 <= r9) goto L_0x0037;
    L_0x0036:
        r0 = 2;
    L_0x0037:
        r1 = r7.Q;
        r2 = b.n.d.b.CREATED;
        if (r1 != r2) goto L_0x0042;
    L_0x003d:
        r0 = java.lang.Math.min(r0, r8);
        goto L_0x004a;
    L_0x0042:
        r1 = r1.ordinal();
        r0 = java.lang.Math.min(r0, r1);
    L_0x004a:
        r11 = r0;
        r0 = r7.a;
        r12 = "Fragment ";
        r13 = 0;
        r14 = 0;
        if (r0 > r11) goto L_0x03d0;
    L_0x0053:
        r0 = r7.m;
        if (r0 == 0) goto L_0x005c;
    L_0x0057:
        r0 = r7.n;
        if (r0 != 0) goto L_0x005c;
    L_0x005b:
        return;
    L_0x005c:
        r0 = r17.f();
        if (r0 != 0) goto L_0x0068;
    L_0x0062:
        r0 = r17.g();
        if (r0 == 0) goto L_0x007c;
    L_0x0068:
        r7.c0(r13);
        r7.d0(r13);
        r2 = r17.w();
        r3 = 0;
        r4 = 0;
        r5 = 1;
        r0 = r16;
        r1 = r17;
        r0.h0(r1, r2, r3, r4, r5);
    L_0x007c:
        r0 = r7.a;
        if (r0 == 0) goto L_0x0088;
    L_0x0080:
        if (r0 == r8) goto L_0x0201;
    L_0x0082:
        if (r0 == r9) goto L_0x033d;
    L_0x0084:
        if (r0 == r10) goto L_0x0381;
    L_0x0086:
        goto L_0x06dd;
    L_0x0088:
        if (r11 <= 0) goto L_0x0201;
    L_0x008a:
        r0 = r7.b;
        if (r0 == 0) goto L_0x00df;
    L_0x008e:
        r1 = r6.p;
        r1 = r1.b;
        r1 = r1.getClassLoader();
        r0.setClassLoader(r1);
        r0 = r7.b;
        r1 = "android:view_state";
        r0 = r0.getSparseParcelableArray(r1);
        r7.c = r0;
        r0 = r7.b;
        r1 = "android:target_state";
        r0 = r6.c(r0, r1);
        if (r0 == 0) goto L_0x00b0;
    L_0x00ad:
        r0 = r0.e;
        goto L_0x00b1;
    L_0x00b0:
        r0 = r13;
    L_0x00b1:
        r7.h = r0;
        if (r0 == 0) goto L_0x00bf;
    L_0x00b5:
        r0 = r7.b;
        r1 = "android:target_req_state";
        r0 = r0.getInt(r1, r14);
        r7.i = r0;
    L_0x00bf:
        r0 = r7.d;
        if (r0 == 0) goto L_0x00cc;
    L_0x00c3:
        r0 = r0.booleanValue();
        r7.J = r0;
        r7.d = r13;
        goto L_0x00d6;
    L_0x00cc:
        r0 = r7.b;
        r1 = "android:user_visible_hint";
        r0 = r0.getBoolean(r1, r8);
        r7.J = r0;
    L_0x00d6:
        r0 = r7.J;
        if (r0 != 0) goto L_0x00df;
    L_0x00da:
        r7.I = r8;
        if (r11 <= r9) goto L_0x00df;
    L_0x00de:
        r11 = 2;
    L_0x00df:
        r0 = r6.p;
        r7.s = r0;
        r1 = r6.r;
        r7.u = r1;
        if (r1 == 0) goto L_0x00ec;
    L_0x00e9:
        r0 = r1.t;
        goto L_0x00ee;
    L_0x00ec:
        r0 = r0.e;
    L_0x00ee:
        r7.r = r0;
        r0 = r7.g;
        r10 = " that does not belong to this FragmentManager!";
        r15 = " declared target fragment ";
        if (r0 == 0) goto L_0x013a;
    L_0x00f8:
        r1 = r6.g;
        r0 = r0.e;
        r0 = r1.get(r0);
        r1 = r7.g;
        if (r0 != r1) goto L_0x011a;
    L_0x0104:
        r0 = r1.a;
        if (r0 >= r8) goto L_0x0111;
    L_0x0108:
        r2 = 1;
        r3 = 0;
        r4 = 0;
        r5 = 1;
        r0 = r16;
        r0.h0(r1, r2, r3, r4, r5);
    L_0x0111:
        r0 = r7.g;
        r0 = r0.e;
        r7.h = r0;
        r7.g = r13;
        goto L_0x013a;
    L_0x011a:
        r0 = new java.lang.IllegalStateException;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r1.append(r12);
        r1.append(r7);
        r1.append(r15);
        r2 = r7.g;
        r1.append(r2);
        r1.append(r10);
        r1 = r1.toString();
        r0.<init>(r1);
        throw r0;
    L_0x013a:
        r0 = r7.h;
        if (r0 == 0) goto L_0x0171;
    L_0x013e:
        r1 = r6.g;
        r0 = r1.get(r0);
        r1 = r0;
        r1 = (androidx.fragment.app.Fragment) r1;
        if (r1 == 0) goto L_0x0157;
    L_0x0149:
        r0 = r1.a;
        if (r0 >= r8) goto L_0x0171;
    L_0x014d:
        r2 = 1;
        r3 = 0;
        r4 = 0;
        r5 = 1;
        r0 = r16;
        r0.h0(r1, r2, r3, r4, r5);
        goto L_0x0171;
    L_0x0157:
        r0 = new java.lang.IllegalStateException;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r1.append(r12);
        r1.append(r7);
        r1.append(r15);
        r2 = r7.h;
        r1 = c.b.a.a.a.d(r1, r2, r10);
        r0.<init>(r1);
        throw r0;
    L_0x0171:
        r0 = r6.p;
        r0 = r0.b;
        r6.C(r7, r0, r14);
        r0 = r7.t;
        r1 = r7.s;
        r2 = new b.l.a.c;
        r2.m5086init(r7);
        r0.i(r1, r2, r7);
        r7.E = r14;
        r0 = r7.s;
        r0 = r0.b;
        r7.D(r0);
        r0 = r7.E;
        if (r0 == 0) goto L_0x01f5;
    L_0x0191:
        r0 = r7.u;
        if (r0 != 0) goto L_0x019a;
    L_0x0195:
        r0 = r6.p;
        r0.f(r7);
    L_0x019a:
        r0 = r6.p;
        r0 = r0.b;
        r6.x(r7, r0, r14);
        r0 = r7.P;
        if (r0 != 0) goto L_0x01dc;
    L_0x01a5:
        r0 = r7.b;
        r6.D(r7, r0, r14);
        r0 = r7.b;
        r1 = r7.t;
        r1.i0();
        r7.a = r8;
        r7.E = r14;
        r1 = r7.U;
        r1.a(r0);
        r7.E(r0);
        r7.P = r8;
        r0 = r7.E;
        if (r0 == 0) goto L_0x01d0;
    L_0x01c3:
        r0 = r7.R;
        r1 = b.n.d.a.ON_CREATE;
        r0.d(r1);
        r0 = r7.b;
        r6.y(r7, r0, r14);
        goto L_0x0201;
    L_0x01d0:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onCreate()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x01dc:
        r0 = r7.b;
        if (r0 == 0) goto L_0x01f2;
    L_0x01e0:
        r1 = "android:support:fragments";
        r0 = r0.getParcelable(r1);
        if (r0 == 0) goto L_0x01f2;
    L_0x01e8:
        r1 = r7.t;
        r1.o0(r0);
        r0 = r7.t;
        r0.r();
    L_0x01f2:
        r7.a = r8;
        goto L_0x0201;
    L_0x01f5:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onAttach()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x0201:
        r0 = 8;
        if (r11 <= 0) goto L_0x023d;
    L_0x0205:
        r1 = r7.m;
        if (r1 == 0) goto L_0x023d;
    L_0x0209:
        r1 = r7.p;
        if (r1 != 0) goto L_0x023d;
    L_0x020d:
        r1 = r7.b;
        r1 = r7.L(r1);
        r7.O = r1;
        r2 = r7.b;
        r7.U(r1, r13, r2);
        r1 = r7.G;
        if (r1 == 0) goto L_0x023b;
    L_0x021e:
        r7.H = r1;
        r1.setSaveFromParentEnabled(r14);
        r1 = r7.y;
        if (r1 == 0) goto L_0x022c;
    L_0x0227:
        r1 = r7.G;
        r1.setVisibility(r0);
    L_0x022c:
        r1 = r7.G;
        r2 = r7.b;
        r7.T(r1, r2);
        r1 = r7.G;
        r2 = r7.b;
        r6.I(r7, r1, r2, r14);
        goto L_0x023d;
    L_0x023b:
        r7.H = r13;
    L_0x023d:
        if (r11 <= r8) goto L_0x033d;
    L_0x023f:
        r1 = r7.m;
        if (r1 != 0) goto L_0x02ee;
    L_0x0243:
        r1 = r7.w;
        if (r1 == 0) goto L_0x02a3;
    L_0x0247:
        r2 = -1;
        if (r1 == r2) goto L_0x0292;
    L_0x024a:
        r2 = r6.q;
        r1 = r2.b(r1);
        r1 = (android.view.ViewGroup) r1;
        if (r1 != 0) goto L_0x02a4;
    L_0x0254:
        r2 = r7.o;
        if (r2 == 0) goto L_0x0259;
    L_0x0258:
        goto L_0x02a4;
    L_0x0259:
        r0 = r17.s();	 Catch:{ NotFoundException -> 0x0264 }
        r1 = r7.w;	 Catch:{ NotFoundException -> 0x0264 }
        r0 = r0.getResourceName(r1);	 Catch:{ NotFoundException -> 0x0264 }
        goto L_0x0266;
    L_0x0264:
        r0 = "unknown";
    L_0x0266:
        r1 = new java.lang.IllegalArgumentException;
        r2 = "No view found for id 0x";
        r2 = c.b.a.a.a.g(r2);
        r3 = r7.w;
        r3 = java.lang.Integer.toHexString(r3);
        r2.append(r3);
        r3 = " (";
        r2.append(r3);
        r2.append(r0);
        r0 = ") for fragment ";
        r2.append(r0);
        r2.append(r7);
        r0 = r2.toString();
        r1.<init>(r0);
        r6.w0(r1);
        throw r13;
    L_0x0292:
        r0 = new java.lang.IllegalArgumentException;
        r1 = "Cannot create fragment ";
        r2 = " for a container view with no id";
        r1 = c.b.a.a.a.C(r1, r7, r2);
        r0.<init>(r1);
        r6.w0(r0);
        throw r13;
    L_0x02a3:
        r1 = r13;
    L_0x02a4:
        r7.F = r1;
        r2 = r7.b;
        r2 = r7.L(r2);
        r7.O = r2;
        r3 = r7.b;
        r7.U(r2, r1, r3);
        r2 = r7.G;
        if (r2 == 0) goto L_0x02ec;
    L_0x02b7:
        r7.H = r2;
        r2.setSaveFromParentEnabled(r14);
        if (r1 == 0) goto L_0x02c3;
    L_0x02be:
        r2 = r7.G;
        r1.addView(r2);
    L_0x02c3:
        r1 = r7.y;
        if (r1 == 0) goto L_0x02cc;
    L_0x02c7:
        r1 = r7.G;
        r1.setVisibility(r0);
    L_0x02cc:
        r0 = r7.G;
        r1 = r7.b;
        r7.T(r0, r1);
        r0 = r7.G;
        r1 = r7.b;
        r6.I(r7, r0, r1, r14);
        r0 = r7.G;
        r0 = r0.getVisibility();
        if (r0 != 0) goto L_0x02e8;
    L_0x02e2:
        r0 = r7.F;
        if (r0 == 0) goto L_0x02e8;
    L_0x02e6:
        r0 = 1;
        goto L_0x02e9;
    L_0x02e8:
        r0 = 0;
    L_0x02e9:
        r7.L = r0;
        goto L_0x02ee;
    L_0x02ec:
        r7.H = r13;
    L_0x02ee:
        r0 = r7.b;
        r1 = r7.t;
        r1.i0();
        r7.a = r9;
        r7.E = r14;
        r7.C(r0);
        r0 = r7.E;
        if (r0 == 0) goto L_0x0331;
    L_0x0300:
        r0 = r7.t;
        r0.u = r14;
        r0.v = r14;
        r0.P(r9);
        r0 = r7.b;
        r6.w(r7, r0, r14);
        r0 = r7.G;
        if (r0 == 0) goto L_0x032e;
    L_0x0312:
        r0 = r7.c;
        if (r0 == 0) goto L_0x031d;
    L_0x0316:
        r1 = r7.H;
        r1.restoreHierarchyState(r0);
        r7.c = r13;
    L_0x031d:
        r7.E = r14;
        r7.E = r8;
        r0 = r7.G;
        if (r0 == 0) goto L_0x032e;
    L_0x0325:
        r0 = r7.S;
        r1 = b.n.d.a.ON_CREATE;
        r0 = r0.a;
        r0.d(r1);
    L_0x032e:
        r7.b = r13;
        goto L_0x033d;
    L_0x0331:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onActivityCreated()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x033d:
        if (r11 <= r9) goto L_0x0381;
    L_0x033f:
        r0 = r7.t;
        r0.i0();
        r0 = r7.t;
        r0.U();
        r0 = 3;
        r7.a = r0;
        r7.E = r14;
        r17.R();
        r0 = r7.E;
        if (r0 == 0) goto L_0x0375;
    L_0x0355:
        r0 = r7.R;
        r1 = b.n.d.a.ON_START;
        r0.d(r1);
        r0 = r7.G;
        if (r0 == 0) goto L_0x0367;
    L_0x0360:
        r0 = r7.S;
        r0 = r0.a;
        r0.d(r1);
    L_0x0367:
        r0 = r7.t;
        r0.u = r14;
        r0.v = r14;
        r1 = 3;
        r0.P(r1);
        r6.G(r7, r14);
        goto L_0x0381;
    L_0x0375:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onStart()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x0381:
        r0 = 3;
        if (r11 <= r0) goto L_0x06dd;
    L_0x0384:
        r0 = r7.t;
        r0.i0();
        r0 = r7.t;
        r0.U();
        r0 = 4;
        r7.a = r0;
        r7.E = r14;
        r17.P();
        r0 = r7.E;
        if (r0 == 0) goto L_0x03c4;
    L_0x039a:
        r0 = r7.R;
        r1 = b.n.d.a.ON_RESUME;
        r0.d(r1);
        r0 = r7.G;
        if (r0 == 0) goto L_0x03ac;
    L_0x03a5:
        r0 = r7.S;
        r0 = r0.a;
        r0.d(r1);
    L_0x03ac:
        r0 = r7.t;
        r0.u = r14;
        r0.v = r14;
        r1 = 4;
        r0.P(r1);
        r0 = r7.t;
        r0.U();
        r6.E(r7, r14);
        r7.b = r13;
        r7.c = r13;
        goto L_0x06dd;
    L_0x03c4:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onResume()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x03d0:
        if (r0 <= r11) goto L_0x06dd;
    L_0x03d2:
        if (r0 == r8) goto L_0x0544;
    L_0x03d4:
        if (r0 == r9) goto L_0x044e;
    L_0x03d6:
        r1 = 3;
        if (r0 == r1) goto L_0x0415;
    L_0x03d9:
        r2 = 4;
        if (r0 == r2) goto L_0x03de;
    L_0x03dc:
        goto L_0x06dd;
    L_0x03de:
        if (r11 >= r2) goto L_0x0415;
    L_0x03e0:
        r0 = r7.t;
        r0.P(r1);
        r0 = r7.G;
        if (r0 == 0) goto L_0x03f2;
    L_0x03e9:
        r0 = r7.S;
        r1 = b.n.d.a.ON_PAUSE;
        r0 = r0.a;
        r0.d(r1);
    L_0x03f2:
        r0 = r7.R;
        r1 = b.n.d.a.ON_PAUSE;
        r0.d(r1);
        r0 = 3;
        r7.a = r0;
        r7.E = r14;
        r17.N();
        r0 = r7.E;
        if (r0 == 0) goto L_0x0409;
    L_0x0405:
        r6.B(r7, r14);
        goto L_0x0415;
    L_0x0409:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onPause()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x0415:
        r0 = 3;
        if (r11 >= r0) goto L_0x044e;
    L_0x0418:
        r0 = r7.t;
        r0.v = r8;
        r0.P(r9);
        r0 = r7.G;
        if (r0 == 0) goto L_0x042c;
    L_0x0423:
        r0 = r7.S;
        r1 = b.n.d.a.ON_STOP;
        r0 = r0.a;
        r0.d(r1);
    L_0x042c:
        r0 = r7.R;
        r1 = b.n.d.a.ON_STOP;
        r0.d(r1);
        r7.a = r9;
        r7.E = r14;
        r17.S();
        r0 = r7.E;
        if (r0 == 0) goto L_0x0442;
    L_0x043e:
        r6.H(r7, r14);
        goto L_0x044e;
    L_0x0442:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onStop()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x044e:
        if (r11 >= r9) goto L_0x0544;
    L_0x0450:
        r0 = r7.G;
        if (r0 == 0) goto L_0x0463;
    L_0x0454:
        r0 = r6.p;
        r0 = r0.n(r7);
        if (r0 == 0) goto L_0x0463;
    L_0x045c:
        r0 = r7.c;
        if (r0 != 0) goto L_0x0463;
    L_0x0460:
        r16.r0(r17);
    L_0x0463:
        r0 = r7.t;
        r0.P(r8);
        r0 = r7.G;
        if (r0 == 0) goto L_0x0475;
    L_0x046c:
        r0 = r7.S;
        r1 = b.n.d.a.ON_DESTROY;
        r0 = r0.a;
        r0.d(r1);
    L_0x0475:
        r7.a = r8;
        r7.E = r14;
        r17.J();
        r0 = r7.E;
        if (r0 == 0) goto L_0x0538;
    L_0x0480:
        r0 = b.o.a.a.b(r17);
        r0 = (b.o.a.b) r0;
        r0 = r0.b;
        r1 = r0.b;
        r1 = r1.i();
        r2 = 0;
    L_0x048f:
        if (r2 >= r1) goto L_0x049f;
    L_0x0491:
        r3 = r0.b;
        r3 = r3.j(r2);
        r3 = (b.o.a.b.a) r3;
        java.util.Objects.requireNonNull(r3);
        r2 = r2 + 1;
        goto L_0x048f;
    L_0x049f:
        r7.p = r14;
        r6.J(r7, r14);
        r0 = r7.G;
        if (r0 == 0) goto L_0x0528;
    L_0x04a8:
        r1 = r7.F;
        if (r1 == 0) goto L_0x0528;
    L_0x04ac:
        r1.endViewTransition(r0);
        r0 = r7.G;
        r0.clearAnimation();
        r0 = r7.u;
        if (r0 == 0) goto L_0x04bc;
    L_0x04b8:
        r0 = r0.l;
        if (r0 != 0) goto L_0x0528;
    L_0x04bc:
        r0 = r6.o;
        r1 = 0;
        if (r0 <= 0) goto L_0x04dc;
    L_0x04c1:
        r0 = r6.w;
        if (r0 != 0) goto L_0x04dc;
    L_0x04c5:
        r0 = r7.G;
        r0 = r0.getVisibility();
        if (r0 != 0) goto L_0x04dc;
    L_0x04cd:
        r0 = r7.N;
        r0 = (r0 > r1 ? 1 : (r0 == r1 ? 0 : -1));
        if (r0 < 0) goto L_0x04dc;
    L_0x04d3:
        r0 = r19;
        r2 = r20;
        r0 = r6.c0(r7, r0, r14, r2);
        goto L_0x04dd;
    L_0x04dc:
        r0 = r13;
    L_0x04dd:
        r7.N = r1;
        if (r0 == 0) goto L_0x0521;
    L_0x04e1:
        r1 = r7.G;
        r2 = r7.F;
        r2.startViewTransition(r1);
        r3 = r17.b();
        r3.c = r11;
        r3 = r0.a;
        if (r3 == 0) goto L_0x050c;
    L_0x04f2:
        r3 = new b.l.a.i$e;
        r0 = r0.a;
        r3.m574init(r0, r2, r1);
        r0 = r7.G;
        r7.c0(r0);
        r0 = new b.l.a.j;
        r0.m577init(r6, r2, r7);
        r3.setAnimationListener(r0);
        r0 = r7.G;
        r0.startAnimation(r3);
        goto L_0x0521;
    L_0x050c:
        r0 = r0.b;
        r7.d0(r0);
        r3 = new b.l.a.k;
        r3.m578init(r6, r2, r1, r7);
        r0.addListener(r3);
        r1 = r7.G;
        r0.setTarget(r1);
        r0.start();
    L_0x0521:
        r0 = r7.F;
        r1 = r7.G;
        r0.removeView(r1);
    L_0x0528:
        r7.F = r13;
        r7.G = r13;
        r7.S = r13;
        r0 = r7.T;
        r0.g(r13);
        r7.H = r13;
        r7.n = r14;
        goto L_0x0544;
    L_0x0538:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onDestroyView()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x0544:
        if (r11 >= r8) goto L_0x06dd;
    L_0x0546:
        r0 = r6.w;
        if (r0 == 0) goto L_0x056b;
    L_0x054a:
        r0 = r17.f();
        if (r0 == 0) goto L_0x055b;
    L_0x0550:
        r0 = r17.f();
        r7.c0(r13);
        r0.clearAnimation();
        goto L_0x056b;
    L_0x055b:
        r0 = r17.g();
        if (r0 == 0) goto L_0x056b;
    L_0x0561:
        r0 = r17.g();
        r7.d0(r13);
        r0.cancel();
    L_0x056b:
        r0 = r17.f();
        if (r0 != 0) goto L_0x06d6;
    L_0x0571:
        r0 = r17.g();
        if (r0 == 0) goto L_0x0579;
    L_0x0577:
        goto L_0x06d6;
    L_0x0579:
        r0 = r7.l;
        if (r0 == 0) goto L_0x0585;
    L_0x057d:
        r0 = r17.B();
        if (r0 != 0) goto L_0x0585;
    L_0x0583:
        r0 = 1;
        goto L_0x0586;
    L_0x0585:
        r0 = 0;
    L_0x0586:
        if (r0 != 0) goto L_0x0594;
    L_0x0588:
        r1 = r6.E;
        r1 = r1.b(r7);
        if (r1 == 0) goto L_0x0591;
    L_0x0590:
        goto L_0x0594;
    L_0x0591:
        r7.a = r14;
        goto L_0x05fd;
    L_0x0594:
        r1 = r6.p;
        r2 = r1 instanceof b.n.t;
        if (r2 == 0) goto L_0x059f;
    L_0x059a:
        r1 = r6.E;
        r8 = r1.f;
        goto L_0x05ac;
    L_0x059f:
        r1 = r1.b;
        r2 = r1 instanceof android.app.Activity;
        if (r2 == 0) goto L_0x05ac;
    L_0x05a5:
        r1 = (android.app.Activity) r1;
        r1 = r1.isChangingConfigurations();
        r8 = r8 ^ r1;
    L_0x05ac:
        if (r0 != 0) goto L_0x05b0;
    L_0x05ae:
        if (r8 == 0) goto L_0x05e1;
    L_0x05b0:
        r1 = r6.E;
        java.util.Objects.requireNonNull(r1);
        r2 = r1.c;
        r3 = r7.e;
        r2 = r2.get(r3);
        r2 = (b.l.a.m) r2;
        if (r2 == 0) goto L_0x05cb;
    L_0x05c1:
        r2.a();
        r2 = r1.c;
        r3 = r7.e;
        r2.remove(r3);
    L_0x05cb:
        r2 = r1.d;
        r3 = r7.e;
        r2 = r2.get(r3);
        r2 = (b.n.s) r2;
        if (r2 == 0) goto L_0x05e1;
    L_0x05d7:
        r2.a();
        r1 = r1.d;
        r2 = r7.e;
        r1.remove(r2);
    L_0x05e1:
        r1 = r7.t;
        r1.t();
        r1 = r7.R;
        r2 = b.n.d.a.ON_DESTROY;
        r1.d(r2);
        r7.a = r14;
        r7.E = r14;
        r7.P = r14;
        r17.H();
        r1 = r7.E;
        if (r1 == 0) goto L_0x06ca;
    L_0x05fa:
        r6.z(r7, r14);
    L_0x05fd:
        r7.E = r14;
        r17.K();
        r7.O = r13;
        r1 = r7.E;
        if (r1 == 0) goto L_0x06be;
    L_0x0608:
        r1 = r7.t;
        r2 = r1.w;
        if (r2 != 0) goto L_0x0618;
    L_0x060e:
        r1.t();
        r1 = new b.l.a.i;
        r1.m5093init();
        r7.t = r1;
    L_0x0618:
        r6.A(r7, r14);
        if (r21 != 0) goto L_0x06dd;
    L_0x061d:
        if (r0 != 0) goto L_0x0644;
    L_0x061f:
        r0 = r6.E;
        r0 = r0.b(r7);
        if (r0 == 0) goto L_0x0628;
    L_0x0627:
        goto L_0x0644;
    L_0x0628:
        r7.s = r13;
        r7.u = r13;
        r7.r = r13;
        r0 = r7.h;
        if (r0 == 0) goto L_0x06dd;
    L_0x0632:
        r1 = r6.g;
        r0 = r1.get(r0);
        r0 = (androidx.fragment.app.Fragment) r0;
        if (r0 == 0) goto L_0x06dd;
    L_0x063c:
        r1 = r0.A;
        if (r1 == 0) goto L_0x06dd;
    L_0x0640:
        r7.g = r0;
        goto L_0x06dd;
    L_0x0644:
        r0 = r6.g;
        r1 = r7.e;
        r0 = r0.get(r1);
        if (r0 != 0) goto L_0x0650;
    L_0x064e:
        goto L_0x06dd;
    L_0x0650:
        r0 = r6.g;
        r0 = r0.values();
        r0 = r0.iterator();
    L_0x065a:
        r1 = r0.hasNext();
        if (r1 == 0) goto L_0x0677;
    L_0x0660:
        r1 = r0.next();
        r1 = (androidx.fragment.app.Fragment) r1;
        if (r1 == 0) goto L_0x065a;
    L_0x0668:
        r2 = r7.e;
        r3 = r1.h;
        r2 = r2.equals(r3);
        if (r2 == 0) goto L_0x065a;
    L_0x0672:
        r1.g = r7;
        r1.h = r13;
        goto L_0x065a;
    L_0x0677:
        r0 = r6.g;
        r1 = r7.e;
        r0.put(r1, r13);
        r16.n0(r17);
        r0 = r7.h;
        if (r0 == 0) goto L_0x068f;
    L_0x0685:
        r1 = r6.g;
        r0 = r1.get(r0);
        r0 = (androidx.fragment.app.Fragment) r0;
        r7.g = r0;
    L_0x068f:
        r17.y();
        r0 = java.util.UUID.randomUUID();
        r0 = r0.toString();
        r7.e = r0;
        r7.k = r14;
        r7.l = r14;
        r7.m = r14;
        r7.n = r14;
        r7.o = r14;
        r7.q = r14;
        r7.r = r13;
        r0 = new b.l.a.i;
        r0.m5093init();
        r7.t = r0;
        r7.s = r13;
        r7.v = r14;
        r7.w = r14;
        r7.x = r13;
        r7.y = r14;
        r7.z = r14;
        goto L_0x06dd;
    L_0x06be:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onDetach()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x06ca:
        r0 = new b.l.a.b0;
        r1 = " did not call through to super.onDestroy()";
        r1 = c.b.a.a.a.C(r12, r7, r1);
        r0.m564init(r1);
        throw r0;
    L_0x06d6:
        r0 = r17.b();
        r0.c = r11;
        goto L_0x06de;
    L_0x06dd:
        r8 = r11;
    L_0x06de:
        r0 = r7.a;
        if (r0 == r8) goto L_0x070c;
    L_0x06e2:
        r0 = new java.lang.StringBuilder;
        r0.<init>();
        r1 = "moveToState: Fragment state for ";
        r0.append(r1);
        r0.append(r7);
        r1 = " not updated inline; expected state ";
        r0.append(r1);
        r0.append(r8);
        r1 = " found ";
        r0.append(r1);
        r1 = r7.a;
        r0.append(r1);
        r0 = r0.toString();
        r1 = "FragmentManager";
        android.util.Log.w(r1, r0);
        r7.a = r8;
    L_0x070c:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.l.a.i.h0(androidx.fragment.app.Fragment, int, int, int, boolean):void");
    }

    public void i(g gVar, d dVar, Fragment fragment) {
        if (this.p == null) {
            this.p = gVar;
            this.q = dVar;
            this.r = fragment;
            if (fragment != null) {
                x0();
            }
            if (gVar instanceof b.a.c) {
                b.n.g gVar2 = (b.a.c) gVar;
                OnBackPressedDispatcher c = gVar2.c();
                this.j = c;
                if (fragment != null) {
                    gVar2 = fragment;
                }
                b.a.b bVar = this.k;
                Objects.requireNonNull(c);
                b.n.d a = gVar2.a();
                if (((b.n.h) a).b != b.n.d.b.DESTROYED) {
                    bVar.b.add(new LifecycleOnBackPressedCancellable(a, bVar));
                }
            }
            if (fragment != null) {
                m mVar = fragment.r.E;
                m mVar2 = (m) mVar.c.get(fragment.e);
                if (mVar2 == null) {
                    mVar2 = new m(mVar.e);
                    mVar.c.put(fragment.e, mVar2);
                }
                this.E = mVar2;
                return;
            } else if (gVar instanceof t) {
                s j = ((t) gVar).j();
                q qVar = m.g;
                Class cls = m.class;
                String canonicalName = cls.getCanonicalName();
                if (canonicalName != null) {
                    canonicalName = c.b.a.a.a.D("androidx.lifecycle.ViewModelProvider.DefaultKey:", canonicalName);
                    p pVar = (p) j.a.get(canonicalName);
                    if (!cls.isInstance(pVar)) {
                        p a2;
                        if (qVar instanceof r) {
                            a2 = ((r) qVar).a(canonicalName, cls);
                        } else {
                            a2 = ((b.l.a.m.a) qVar).a(cls);
                        }
                        pVar = a2;
                        p pVar2 = (p) j.a.put(canonicalName, pVar);
                        if (pVar2 != null) {
                            pVar2.a();
                        }
                    }
                    this.E = (m) pVar;
                    return;
                }
                throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
            } else {
                this.E = new m(false);
                return;
            }
        }
        throw new IllegalStateException("Already attached");
    }

    public void i0() {
        int i = 0;
        this.u = false;
        this.v = false;
        int size = this.f.size();
        while (i < size) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null) {
                fragment.t.i0();
            }
            i++;
        }
    }

    public void j(Fragment fragment) {
        if (fragment.z) {
            fragment.z = false;
            if (!fragment.k) {
                if (this.f.contains(fragment)) {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append("Fragment already added: ");
                    stringBuilder.append(fragment);
                    throw new IllegalStateException(stringBuilder.toString());
                }
                synchronized (this.f) {
                    this.f.add(fragment);
                }
                fragment.k = true;
                if (a0(fragment)) {
                    this.t = true;
                }
            }
        }
    }

    public void j0(Fragment fragment) {
        if (fragment.I) {
            if (this.d) {
                this.x = true;
                return;
            }
            fragment.I = false;
            h0(fragment, this.o, 0, 0, false);
        }
    }

    public final void k() {
        this.g.values().removeAll(Collections.singleton(null));
    }

    public boolean k0(ArrayList<a> arrayList, ArrayList<Boolean> arrayList2, String str, int i, int i2) {
        Boolean bool = Boolean.TRUE;
        ArrayList arrayList3 = this.h;
        if (arrayList3 == null) {
            return false;
        }
        int size;
        if (str == null && i < 0 && (i2 & 1) == 0) {
            size = arrayList3.size() - 1;
            if (size < 0) {
                return false;
            }
            arrayList.add(this.h.remove(size));
            arrayList2.add(bool);
        } else {
            int i3 = -1;
            if (str != null || i >= 0) {
                int size2 = arrayList3.size() - 1;
                while (size2 >= 0) {
                    a aVar = (a) this.h.get(size2);
                    if ((str != null && str.equals(aVar.i)) || (i >= 0 && i == aVar.s)) {
                        break;
                    }
                    size2--;
                }
                if (size2 < 0) {
                    return false;
                }
                if ((i2 & 1) != 0) {
                    while (true) {
                        size2--;
                        if (size2 < 0) {
                            break;
                        }
                        a aVar2 = (a) this.h.get(size2);
                        if (str == null || !str.equals(aVar2.i)) {
                            if (i < 0 || i != aVar2.s) {
                                break;
                            }
                        }
                    }
                }
                i3 = size2;
            }
            if (i3 == this.h.size() - 1) {
                return false;
            }
            for (size = this.h.size() - 1; size > i3; size--) {
                arrayList.add(this.h.remove(size));
                arrayList2.add(bool);
            }
        }
        return true;
    }

    public final void l() {
        if (d()) {
            throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
        }
    }

    public void l0(Fragment fragment) {
        int B = fragment.B() ^ 1;
        if (!fragment.z || B != 0) {
            synchronized (this.f) {
                this.f.remove(fragment);
            }
            if (a0(fragment)) {
                this.t = true;
            }
            fragment.k = false;
            fragment.l = true;
        }
    }

    public final void m() {
        this.d = false;
        this.z.clear();
        this.y.clear();
    }

    public final void m0(ArrayList<a> arrayList, ArrayList<Boolean> arrayList2) {
        if (arrayList != null && !arrayList.isEmpty()) {
            if (arrayList2 == null || arrayList.size() != arrayList2.size()) {
                throw new IllegalStateException("Internal error with the back stack records");
            }
            W(arrayList, arrayList2);
            int size = arrayList.size();
            int i = 0;
            int i2 = 0;
            while (i < size) {
                if (!((a) arrayList.get(i)).p) {
                    if (i2 != i) {
                        V(arrayList, arrayList2, i2, i);
                    }
                    i2 = i + 1;
                    if (((Boolean) arrayList2.get(i)).booleanValue()) {
                        while (i2 < size && ((Boolean) arrayList2.get(i2)).booleanValue() && !((a) arrayList.get(i2)).p) {
                            i2++;
                        }
                    }
                    V(arrayList, arrayList2, i, i2);
                    i = i2 - 1;
                }
                i++;
            }
            if (i2 != size) {
                V(arrayList, arrayList2, i2, size);
            }
        }
    }

    public void n(a aVar, boolean z, boolean z2, boolean z3) {
        if (z) {
            aVar.o(z3);
        } else {
            aVar.n();
        }
        ArrayList arrayList = new ArrayList(1);
        ArrayList arrayList2 = new ArrayList(1);
        arrayList.add(aVar);
        arrayList2.add(Boolean.valueOf(z));
        if (z2) {
            u.o(this, arrayList, arrayList2, 0, 1, true);
        }
        if (z3) {
            g0(this.o, true);
        }
        for (Fragment fragment : this.g.values()) {
            if (fragment != null && fragment.G != null && fragment.L && aVar.p(fragment.w)) {
                float f = fragment.N;
                if (f > 0.0f) {
                    fragment.G.setAlpha(f);
                }
                if (z3) {
                    fragment.N = 0.0f;
                } else {
                    fragment.N = -1.0f;
                    fragment.L = false;
                }
            }
        }
    }

    public void n0(Fragment fragment) {
        if (!d()) {
            this.E.b.remove(fragment);
        }
    }

    public void o(Fragment fragment) {
        if (!fragment.z) {
            fragment.z = true;
            if (fragment.k) {
                synchronized (this.f) {
                    this.f.remove(fragment);
                }
                if (a0(fragment)) {
                    this.t = true;
                }
                fragment.k = false;
            }
        }
    }

    public void o0(Parcelable parcelable) {
        if (parcelable != null) {
            FragmentManagerState fragmentManagerState = (FragmentManagerState) parcelable;
            if (fragmentManagerState.a != null) {
                int i;
                Fragment fragment;
                for (Fragment fragment2 : this.E.b) {
                    FragmentState fragmentState;
                    Iterator it = fragmentManagerState.a.iterator();
                    while (it.hasNext()) {
                        fragmentState = (FragmentState) it.next();
                        if (fragmentState.b.equals(fragment2.e)) {
                            break;
                        }
                    }
                    fragmentState = null;
                    if (fragmentState == null) {
                        Fragment fragment3 = fragment2;
                        int i2 = 0;
                        i = 0;
                        boolean z = false;
                        h0(fragment3, 1, i2, i, z);
                        fragment2.l = true;
                        h0(fragment3, 0, i2, i, z);
                    } else {
                        fragmentState.n = fragment2;
                        fragment2.c = null;
                        fragment2.q = 0;
                        fragment2.n = false;
                        fragment2.k = false;
                        fragment = fragment2.g;
                        fragment2.h = fragment != null ? fragment.e : null;
                        fragment2.g = null;
                        Bundle bundle = fragmentState.m;
                        if (bundle != null) {
                            bundle.setClassLoader(this.p.b.getClassLoader());
                            fragment2.c = fragmentState.m.getSparseParcelableArray("android:view_state");
                            fragment2.b = fragmentState.m;
                        }
                    }
                }
                this.g.clear();
                Iterator it2 = fragmentManagerState.a.iterator();
                while (it2.hasNext()) {
                    FragmentState fragmentState2 = (FragmentState) it2.next();
                    if (fragmentState2 != null) {
                        ClassLoader classLoader = this.p.b.getClassLoader();
                        f Z = Z();
                        if (fragmentState2.n == null) {
                            Bundle bundle2 = fragmentState2.j;
                            if (bundle2 != null) {
                                bundle2.setClassLoader(classLoader);
                            }
                            Fragment a = Z.a(classLoader, fragmentState2.a);
                            fragmentState2.n = a;
                            a.e0(fragmentState2.j);
                            Bundle bundle3 = fragmentState2.m;
                            if (bundle3 != null) {
                                bundle3.setClassLoader(classLoader);
                                fragmentState2.n.b = fragmentState2.m;
                            } else {
                                fragmentState2.n.b = new Bundle();
                            }
                            fragment = fragmentState2.n;
                            fragment.e = fragmentState2.b;
                            fragment.m = fragmentState2.c;
                            fragment.o = true;
                            fragment.v = fragmentState2.d;
                            fragment.w = fragmentState2.e;
                            fragment.x = fragmentState2.f;
                            fragment.A = fragmentState2.g;
                            fragment.l = fragmentState2.h;
                            fragment.z = fragmentState2.i;
                            fragment.y = fragmentState2.k;
                            fragment.Q = b.n.d.b.values()[fragmentState2.l];
                        }
                        fragment = fragmentState2.n;
                        fragment.r = this;
                        this.g.put(fragment.e, fragment);
                        fragmentState2.n = null;
                    }
                }
                this.f.clear();
                ArrayList arrayList = fragmentManagerState.b;
                if (arrayList != null) {
                    it2 = arrayList.iterator();
                    while (it2.hasNext()) {
                        String str = (String) it2.next();
                        fragment = (Fragment) this.g.get(str);
                        if (fragment != null) {
                            fragment.k = true;
                            if (this.f.contains(fragment)) {
                                StringBuilder stringBuilder = new StringBuilder();
                                stringBuilder.append("Already added ");
                                stringBuilder.append(fragment);
                                throw new IllegalStateException(stringBuilder.toString());
                            }
                            synchronized (this.f) {
                                this.f.add(fragment);
                            }
                        } else {
                            w0(new IllegalStateException(c.b.a.a.a.E("No instantiated fragment for (", str, ")")));
                            throw null;
                        }
                    }
                }
                if (fragmentManagerState.c != null) {
                    this.h = new ArrayList(fragmentManagerState.c.length);
                    int i3 = 0;
                    while (true) {
                        BackStackState[] backStackStateArr = fragmentManagerState.c;
                        if (i3 >= backStackStateArr.length) {
                            break;
                        }
                        Object obj = backStackStateArr[i3];
                        Objects.requireNonNull(obj);
                        a aVar = new a(this);
                        int i4 = 0;
                        int i5 = 0;
                        while (true) {
                            int[] iArr = obj.a;
                            if (i4 >= iArr.length) {
                                break;
                            }
                            b.l.a.p.a aVar2 = new b.l.a.p.a();
                            i = i4 + 1;
                            aVar2.a = iArr[i4];
                            String str2 = (String) obj.b.get(i5);
                            if (str2 != null) {
                                aVar2.b = (Fragment) this.g.get(str2);
                            } else {
                                aVar2.b = null;
                            }
                            aVar2.g = b.n.d.b.values()[obj.c[i5]];
                            aVar2.h = b.n.d.b.values()[obj.d[i5]];
                            int[] iArr2 = obj.a;
                            int i6 = i + 1;
                            i = iArr2[i];
                            aVar2.c = i;
                            int i7 = i6 + 1;
                            i6 = iArr2[i6];
                            aVar2.d = i6;
                            int i8 = i7 + 1;
                            i7 = iArr2[i7];
                            aVar2.e = i7;
                            int i9 = i8 + 1;
                            i4 = iArr2[i8];
                            aVar2.f = i4;
                            aVar.b = i;
                            aVar.c = i6;
                            aVar.d = i7;
                            aVar.e = i4;
                            aVar.b(aVar2);
                            i5++;
                            i4 = i9;
                        }
                        aVar.f = obj.e;
                        aVar.g = obj.f;
                        aVar.i = obj.g;
                        aVar.s = obj.h;
                        aVar.h = true;
                        aVar.j = obj.i;
                        aVar.k = obj.j;
                        aVar.l = obj.k;
                        aVar.m = obj.l;
                        aVar.n = obj.m;
                        aVar.o = obj.n;
                        aVar.p = obj.o;
                        aVar.i(1);
                        this.h.add(aVar);
                        int i10 = aVar.s;
                        if (i10 >= 0) {
                            synchronized (this) {
                                if (this.l == null) {
                                    this.l = new ArrayList();
                                }
                                i4 = this.l.size();
                                if (i10 < i4) {
                                    this.l.set(i10, aVar);
                                } else {
                                    while (i4 < i10) {
                                        this.l.add(null);
                                        if (this.m == null) {
                                            this.m = new ArrayList();
                                        }
                                        this.m.add(Integer.valueOf(i4));
                                        i4++;
                                    }
                                    this.l.add(aVar);
                                }
                            }
                        }
                        i3++;
                    }
                } else {
                    this.h = null;
                }
                String str3 = fragmentManagerState.d;
                if (str3 != null) {
                    Fragment fragment4 = (Fragment) this.g.get(str3);
                    this.s = fragment4;
                    M(fragment4);
                }
                this.e = fragmentManagerState.e;
            }
        }
    }

    public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        AttributeSet attributeSet2 = attributeSet;
        String str2 = str;
        Fragment fragment = null;
        if (!"fragment".equals(str)) {
            return null;
        }
        String attributeValue = attributeSet2.getAttributeValue(null, "class");
        Context context2 = context;
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet2, g.a);
        int i = 0;
        if (attributeValue == null) {
            attributeValue = obtainStyledAttributes.getString(0);
        }
        String str3 = attributeValue;
        int resourceId = obtainStyledAttributes.getResourceId(1, -1);
        String string = obtainStyledAttributes.getString(2);
        obtainStyledAttributes.recycle();
        if (str3 != null) {
            boolean isAssignableFrom;
            ClassLoader classLoader = context.getClassLoader();
            b.f.h hVar = f.a;
            try {
                isAssignableFrom = Fragment.class.isAssignableFrom(f.b(classLoader, str3));
            } catch (ClassNotFoundException unused) {
                isAssignableFrom = false;
            }
            if (isAssignableFrom) {
                if (view != null) {
                    i = view.getId();
                }
                StringBuilder stringBuilder;
                if (i == -1 && resourceId == -1 && string == null) {
                    stringBuilder = new StringBuilder();
                    stringBuilder.append(attributeSet.getPositionDescription());
                    stringBuilder.append(": Must specify unique android:id, android:tag, or have a parent with an id for ");
                    stringBuilder.append(str3);
                    throw new IllegalArgumentException(stringBuilder.toString());
                }
                if (resourceId != -1) {
                    fragment = a(resourceId);
                }
                if (fragment == null && string != null) {
                    fragment = b(string);
                }
                if (fragment == null && i != -1) {
                    fragment = a(i);
                }
                g gVar;
                Context context3;
                if (fragment == null) {
                    fragment = Z().a(context.getClassLoader(), str3);
                    fragment.m = true;
                    fragment.v = resourceId != 0 ? resourceId : i;
                    fragment.w = i;
                    fragment.x = string;
                    fragment.n = true;
                    fragment.r = this;
                    gVar = this.p;
                    fragment.s = gVar;
                    context3 = gVar.b;
                    fragment.M(attributeSet2, fragment.b);
                    h(fragment, true);
                } else if (fragment.n) {
                    stringBuilder = new StringBuilder();
                    stringBuilder.append(attributeSet.getPositionDescription());
                    stringBuilder.append(": Duplicate id 0x");
                    stringBuilder.append(Integer.toHexString(resourceId));
                    stringBuilder.append(", tag ");
                    stringBuilder.append(string);
                    stringBuilder.append(", or parent id 0x");
                    stringBuilder.append(Integer.toHexString(i));
                    stringBuilder.append(" with another fragment for ");
                    stringBuilder.append(str3);
                    throw new IllegalArgumentException(stringBuilder.toString());
                } else {
                    fragment.n = true;
                    gVar = this.p;
                    fragment.s = gVar;
                    context3 = gVar.b;
                    fragment.M(attributeSet2, fragment.b);
                }
                Fragment fragment2 = fragment;
                int i2 = this.o;
                if (i2 >= 1 || !fragment2.m) {
                    h0(fragment2, i2, 0, 0, false);
                } else {
                    h0(fragment2, 1, 0, 0, false);
                }
                View view2 = fragment2.G;
                if (view2 != null) {
                    if (resourceId != 0) {
                        view2.setId(resourceId);
                    }
                    if (fragment2.G.getTag() == null) {
                        fragment2.G.setTag(string);
                    }
                    return fragment2.G;
                }
                throw new IllegalStateException(c.b.a.a.a.E("Fragment ", str3, " did not create a view."));
            }
        }
        return null;
    }

    public void p(Configuration configuration) {
        for (int i = 0; i < this.f.size(); i++) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null) {
                fragment.E = true;
                fragment.t.p(configuration);
            }
        }
    }

    public Parcelable p0() {
        BackStackState[] backStackStateArr;
        int w;
        Y();
        Iterator it = this.g.values().iterator();
        while (true) {
            backStackStateArr = null;
            if (!it.hasNext()) {
                break;
            }
            Fragment fragment = (Fragment) it.next();
            if (fragment != null) {
                if (fragment.f() != null) {
                    w = fragment.w();
                    View f = fragment.f();
                    Animation animation = f.getAnimation();
                    if (animation != null) {
                        animation.cancel();
                        f.clearAnimation();
                    }
                    fragment.c0(null);
                    h0(fragment, w, 0, 0, false);
                } else if (fragment.g() != null) {
                    fragment.g().end();
                }
            }
        }
        U();
        this.u = true;
        if (this.g.isEmpty()) {
            return null;
        }
        ArrayList arrayList = new ArrayList(this.g.size());
        it = this.g.values().iterator();
        Object obj = null;
        while (true) {
            String str = " was removed from the FragmentManager";
            String str2 = "Failure saving state: active ";
            Fragment fragment2;
            if (it.hasNext()) {
                fragment2 = (Fragment) it.next();
                if (fragment2 != null) {
                    if (fragment2.r == this) {
                        FragmentState fragmentState = new FragmentState(fragment2);
                        arrayList.add(fragmentState);
                        if (fragment2.a <= 0 || fragmentState.m != null) {
                            fragmentState.m = fragment2.b;
                        } else {
                            fragmentState.m = q0(fragment2);
                            str = fragment2.h;
                            if (str != null) {
                                Fragment fragment3 = (Fragment) this.g.get(str);
                                if (fragment3 != null) {
                                    if (fragmentState.m == null) {
                                        fragmentState.m = new Bundle();
                                    }
                                    f(fragmentState.m, "android:target_state", fragment3);
                                    w = fragment2.i;
                                    if (w != 0) {
                                        fragmentState.m.putInt("android:target_req_state", w);
                                    }
                                } else {
                                    StringBuilder stringBuilder = new StringBuilder();
                                    stringBuilder.append("Failure saving state: ");
                                    stringBuilder.append(fragment2);
                                    stringBuilder.append(" has target not in fragment manager: ");
                                    stringBuilder.append(fragment2.h);
                                    w0(new IllegalStateException(stringBuilder.toString()));
                                    throw null;
                                }
                            }
                        }
                        obj = 1;
                    } else {
                        w0(new IllegalStateException(c.b.a.a.a.C(str2, fragment2, str)));
                        throw null;
                    }
                }
            } else if (obj == null) {
                return null;
            } else {
                ArrayList arrayList2;
                int size = this.f.size();
                if (size > 0) {
                    arrayList2 = new ArrayList(size);
                    it = this.f.iterator();
                    while (it.hasNext()) {
                        fragment2 = (Fragment) it.next();
                        arrayList2.add(fragment2.e);
                        if (fragment2.r != this) {
                            w0(new IllegalStateException(c.b.a.a.a.C(str2, fragment2, str)));
                            throw null;
                        }
                    }
                } else {
                    arrayList2 = null;
                }
                ArrayList arrayList3 = this.h;
                if (arrayList3 != null) {
                    size = arrayList3.size();
                    if (size > 0) {
                        backStackStateArr = new BackStackState[size];
                        for (int i = 0; i < size; i++) {
                            backStackStateArr[i] = new BackStackState((a) this.h.get(i));
                        }
                    }
                }
                FragmentManagerState fragmentManagerState = new FragmentManagerState();
                fragmentManagerState.a = arrayList;
                fragmentManagerState.b = arrayList2;
                fragmentManagerState.c = backStackStateArr;
                Fragment fragment4 = this.s;
                if (fragment4 != null) {
                    fragmentManagerState.d = fragment4.e;
                }
                fragmentManagerState.e = this.e;
                return fragmentManagerState;
            }
        }
    }

    public boolean q(MenuItem menuItem) {
        if (this.o < 1) {
            return false;
        }
        for (int i = 0; i < this.f.size(); i++) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null) {
                Object obj = (fragment.y || !fragment.t.q(menuItem)) ? null : 1;
                if (obj != null) {
                    return true;
                }
            }
        }
        return false;
    }

    public Bundle q0(Fragment fragment) {
        if (this.B == null) {
            this.B = new Bundle();
        }
        Bundle bundle = this.B;
        fragment.Q(bundle);
        fragment.U.b(bundle);
        Parcelable p0 = fragment.t.p0();
        if (p0 != null) {
            bundle.putParcelable("android:support:fragments", p0);
        }
        F(fragment, this.B, false);
        Bundle bundle2 = null;
        if (!this.B.isEmpty()) {
            bundle = this.B;
            this.B = null;
            bundle2 = bundle;
        }
        if (fragment.G != null) {
            r0(fragment);
        }
        if (fragment.c != null) {
            if (bundle2 == null) {
                bundle2 = new Bundle();
            }
            bundle2.putSparseParcelableArray("android:view_state", fragment.c);
        }
        if (!fragment.J) {
            if (bundle2 == null) {
                bundle2 = new Bundle();
            }
            bundle2.putBoolean("android:user_visible_hint", fragment.J);
        }
        return bundle2;
    }

    public void r() {
        this.u = false;
        this.v = false;
        P(1);
    }

    public void r0(Fragment fragment) {
        if (fragment.H != null) {
            SparseArray sparseArray = this.C;
            if (sparseArray == null) {
                this.C = new SparseArray();
            } else {
                sparseArray.clear();
            }
            fragment.H.saveHierarchyState(this.C);
            if (this.C.size() > 0) {
                fragment.c = this.C;
                this.C = null;
            }
        }
    }

    public boolean s(Menu menu, MenuInflater menuInflater) {
        int i = 0;
        if (this.o < 1) {
            return false;
        }
        ArrayList arrayList = null;
        boolean z = false;
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            Fragment fragment = (Fragment) this.f.get(i2);
            if (fragment != null) {
                int i3;
                if (fragment.y) {
                    i3 = 0;
                } else {
                    if (fragment.C && fragment.D) {
                        fragment.F(menu, menuInflater);
                        i3 = 1;
                    } else {
                        i3 = 0;
                    }
                    i3 |= fragment.t.s(menu, menuInflater);
                }
                if (i3 != 0) {
                    if (arrayList == null) {
                        arrayList = new ArrayList();
                    }
                    arrayList.add(fragment);
                    z = true;
                }
            }
        }
        if (this.i != null) {
            while (i < this.i.size()) {
                Fragment fragment2 = (Fragment) this.i.get(i);
                if (arrayList == null || !arrayList.contains(fragment2)) {
                    fragment2.I();
                }
                i++;
            }
        }
        this.i = arrayList;
        return z;
    }

    public void s0() {
        synchronized (this) {
            ArrayList arrayList = this.D;
            Object obj = null;
            Object obj2 = (arrayList == null || arrayList.isEmpty()) ? null : 1;
            ArrayList arrayList2 = this.c;
            if (arrayList2 != null && arrayList2.size() == 1) {
                obj = 1;
            }
            if (!(obj2 == null && obj == null)) {
                this.p.c.removeCallbacks(this.F);
                this.p.c.post(this.F);
                x0();
            }
        }
    }

    public void t() {
        this.w = true;
        U();
        P(0);
        this.p = null;
        this.q = null;
        this.r = null;
        if (this.j != null) {
            Iterator it = this.k.b.iterator();
            while (it.hasNext()) {
                ((b.a.a) it.next()).cancel();
            }
            this.j = null;
        }
    }

    public void t0(Fragment fragment, b.n.d.b bVar) {
        if (this.g.get(fragment.e) == fragment && (fragment.s == null || fragment.r == this)) {
            fragment.Q = bVar;
            return;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("Fragment ");
        stringBuilder.append(fragment);
        stringBuilder.append(" is not an active fragment of FragmentManager ");
        stringBuilder.append(this);
        throw new IllegalArgumentException(stringBuilder.toString());
    }

    public String toString() {
        StringBuilder stringBuilder = new StringBuilder(AesLen.ROOTKEY_COMPONET_LEN);
        stringBuilder.append("FragmentManager{");
        stringBuilder.append(Integer.toHexString(System.identityHashCode(this)));
        stringBuilder.append(" in ");
        Fragment fragment = this.r;
        if (fragment != null) {
            b.i.b.f.D(fragment, stringBuilder);
        } else {
            b.i.b.f.D(this.p, stringBuilder);
        }
        stringBuilder.append("}}");
        return stringBuilder.toString();
    }

    public void u() {
        for (int i = 0; i < this.f.size(); i++) {
            Fragment fragment = (Fragment) this.f.get(i);
            if (fragment != null) {
                fragment.V();
            }
        }
    }

    public void u0(Fragment fragment) {
        if (fragment == null || (this.g.get(fragment.e) == fragment && (fragment.s == null || fragment.r == this))) {
            Fragment fragment2 = this.s;
            this.s = fragment;
            M(fragment2);
            M(this.s);
            return;
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("Fragment ");
        stringBuilder.append(fragment);
        stringBuilder.append(" is not an active fragment of FragmentManager ");
        stringBuilder.append(this);
        throw new IllegalArgumentException(stringBuilder.toString());
    }

    public void v(boolean z) {
        int size = this.f.size();
        while (true) {
            size--;
            if (size >= 0) {
                Fragment fragment = (Fragment) this.f.get(size);
                if (fragment != null) {
                    fragment.t.v(z);
                }
            } else {
                return;
            }
        }
    }

    public void v0() {
        for (Fragment fragment : this.g.values()) {
            if (fragment != null) {
                j0(fragment);
            }
        }
    }

    public void w(Fragment fragment, Bundle bundle, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.w(fragment, bundle, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public final void w0(RuntimeException runtimeException) {
        String str = "FragmentManager";
        Log.e(str, runtimeException.getMessage());
        Log.e(str, "Activity state:");
        PrintWriter printWriter = new PrintWriter(new b.i.j.a(str));
        g gVar = this.p;
        String str2 = "Failed dumping state";
        String str3 = "  ";
        if (gVar != null) {
            try {
                gVar.g(str3, null, printWriter, new String[0]);
            } catch (Exception e) {
                Log.e(str, str2, e);
            }
        } else {
            try {
                R(str3, null, printWriter, new String[0]);
            } catch (Exception e2) {
                Log.e(str, str2, e2);
            }
        }
        throw runtimeException;
    }

    public void x(Fragment fragment, Context context, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.x(fragment, context, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public final void x0() {
        ArrayList arrayList = this.c;
        boolean z = true;
        if (arrayList == null || arrayList.isEmpty()) {
            b.a.b bVar = this.k;
            ArrayList arrayList2 = this.h;
            if ((arrayList2 != null ? arrayList2.size() : 0) <= 0 || !b0(this.r)) {
                z = false;
            }
            bVar.a = z;
            return;
        }
        this.k.a = true;
    }

    public void y(Fragment fragment, Bundle bundle, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.y(fragment, bundle, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public void z(Fragment fragment, boolean z) {
        Fragment fragment2 = this.r;
        if (fragment2 != null) {
            i iVar = fragment2.r;
            if (iVar instanceof i) {
                iVar.z(fragment, true);
            }
        }
        Iterator it = this.n.iterator();
        while (it.hasNext()) {
            f fVar = (f) it.next();
            if (z) {
                Objects.requireNonNull(fVar);
            } else {
                Objects.requireNonNull(fVar);
                throw null;
            }
        }
    }

    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }
}
